Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve date format performance #136

Merged
merged 3 commits into from Mar 6, 2016
Merged

Improve date format performance #136

merged 3 commits into from Mar 6, 2016

Conversation

TwP
Copy link
Owner

@TwP TwP commented Mar 6, 2016

Since the Ruby 1.9 release, the Time#strftime method has supported native output of microsecond reoslution time stamps. Fixing the date formatting code in the Pattern layout to use this native %6N strftime format dramatically improves logging performance.

TwP added 3 commits March 6, 2016 10:52
Since the Ruby 1.9 release, the `Time#strftime` method has supported native
output of microsecond reoslution time stamps. Fixing the date formatting code in
the Pattern layout to use this native `%6N` `strftime` format dramatically
improves logging performance.
@TwP
Copy link
Owner Author

TwP commented Mar 6, 2016

Here is the performance improvement of this change as evidenced by the test/benchmark.rb script:

== Warn (logged) == master ==
                 user     system      total        real
Logging:     3.140000   0.020000   3.160000 (  3.165859)
Logger:      2.110000   0.000000   2.110000 (  2.117281)
Log4r:       2.520000   0.010000   2.530000 (  2.538968)

== Warn (logged) == date-format-perf-upgrade ==
                 user     system      total        real
Logging:     1.860000   0.020000   1.880000 (  1.885256)
Logger:      2.160000   0.000000   2.160000 (  2.165824)
Log4r:       2.380000   0.010000   2.390000 (  2.391690)

TwP added a commit that referenced this pull request Mar 6, 2016
@TwP TwP merged commit 58aca4d into master Mar 6, 2016
@TwP TwP deleted the date-format-perf-upgrade branch March 6, 2016 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant