falcon: Super slowly Time.parse

There is simple app:

class App
  def call(env)
    1000.times do
      Time.parse("2022-10-24 12:33:44.054237")
    end
    [200, {}, ["App"]]
  end
end

run App.new

Response time: 450 ms - falcon 15 ms - puma 15 ms - rackup

If change to DateTime.parse("2022-10-24 12:33:44.054237"): 13.3 ms - falcon 11.5 ms - puma 11 ms - rackup

How I can fix it?

falcon (0.42.3) async-http (0.59.3) async (2.2.1) rack (2.2.4) ruby 3.1.2p20

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 29 (20 by maintainers)

Most upvoted comments

As this is not a bug with Falcon but some kind of issue on macOS / Time.local, I’m going to close this issue. Thanks for the report, I hope we can figure out why it’s so slow. I could not reproduce this on Linux either.

https://bugs.ruby-lang.org/issues/19461

We couldn’t reproduce the extreme deviation on Linux, and we also found some hacks to fix it on macOS, e.g. TZ= ... or TZ=UTC0 ... seem to alleviate the issue but we don’t know why because it’s in the guts of the OS. I guess it’s possible Linux also has issues but we didn’t see them and were not able to reproduce it.

Hmm, ok 👌 I mean what maybe it’s affect linux systems too, not only macos. Thanks!