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

Optimize logging output #27

Closed
mperham opened this issue Jun 23, 2016 · 4 comments
Closed

Optimize logging output #27

mperham opened this issue Jun 23, 2016 · 4 comments

Comments

@mperham
Copy link
Collaborator

mperham commented Jun 23, 2016

I noticed that setting the benchmark logger level to WARN, the jobs per sec went from 15k to 36k!

To reproduce:

  1. Run make bench.
  2. Edit bench/load.cr and change the log level on line 26 from INFO to WARN.
  3. Repeat 1.

I optimized the Logger::Formatter here to stream to the IO but it didn't appear to make a difference. The logger is used here. Any ideas on how to minimize the log overhead?

@asterite
Copy link

asterite commented Jun 24, 2016

I'll soon take a look, I'll try to run a profiler on it and see what can be optimized. It would be super cool to make it do more jobs per second :-)

@asterite
Copy link

I tried to optimize it but couldn't find a single bottleneck. The time is spread across converting the time to a string, appending to the IO, etc. I don't think there's much that can be done.

@mperham
Copy link
Collaborator Author

mperham commented Jun 24, 2016

Ugh, it's such a huge difference; I'm surprised there's no low-hanging fruit to pick. Thanks for looking at it.

@mperham mperham closed this as completed Jun 24, 2016
@mperham
Copy link
Collaborator Author

mperham commented Jun 24, 2016

BTW I tried turning off the GC and it actually made it slower. Maybe heap size can affect performance? Logging appears to generate ~20% of the garbage.

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

No branches or pull requests

2 participants