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

Tell serde to borrow its cows #6

Merged
merged 5 commits into from Nov 19, 2018

Conversation

Projects
None yet
3 participants
@killercup
Copy link
Contributor

killercup commented Nov 19, 2018

As @dtolnay noted in #3 (review), this is required to tell serde to use references into the input data. Otherwise, it will always copy the data, which performs the same as using String.

@dtolnay
Copy link

dtolnay left a comment

LGTM. On my computer this is a 15% improvement for the sample log file given in #3 (comment).

killercup added some commits Nov 19, 2018

Use link-time otimizations
Benchmarks using hyperfine (`cargo install hyperfine`) and the example
file from #3:

    $ hyperfine 'target/release/kirby example.log.gz'
    Benchmark #1: target/release/kirby example.log.gz
      Time (mean ± σ):      3.453 s ±  0.026 s    [User: 3.406 s, System: 0.033 s]
      Range (min … max):    3.427 s …  3.508 s

Compare this to current master:

    $ hyperfine 'target/release/kirby example.log.gz'
    Benchmark #1: target/release/kirby example.log.gz
      Time (mean ± σ):      4.585 s ±  0.047 s    [User: 4.539 s, System: 0.034 s]
      Range (min … max):    4.530 s …  4.665 s
Use hashbrown instead of fnv
Doesn't do much (previous commit was 3.453 s ±  0.026 s):

    $ hyperfine 'target/release/kirby example.log.gz'
    Benchmark #1: target/release/kirby example.log.gz
      Time (mean ± σ):      3.417 s ±  0.024 s    [User: 3.373 s, System: 0.032 s]
      Range (min … max):    3.384 s …  3.454 s
Allow some methods to be inlined
While this is only a hint for the compiler, the effects are visible
(previous commit had 3.417 s ±  0.024 s):

    $ hyperfine 'target/release/kirby example.log.gz'
    Benchmark #1: target/release/kirby example.log.gz
      Time (mean ± σ):      3.385 s ±  0.029 s    [User: 3.337 s, System: 0.034 s]
      Range (min … max):    3.335 s …  3.418 s
@killercup

This comment has been minimized.

Copy link
Contributor Author

killercup commented Nov 19, 2018

Updated dependencies, used hashbrown HashMap, and enabled link-time otimizations (which makes this quite slow to compile).

Benchmarks of this branch on my 2016 MacBook Pro using hyperfine (cargo install hyperfine) and the example file from #3:

$ hyperfine 'target/release/kirby example.log.gz'
Benchmark #1: target/release/kirby example.log.gz
  Time (mean ± σ):      3.385 s ±  0.029 s    [User: 3.337 s, System: 0.034 s]
  Range (min … max):    3.335 s …  3.418 s

Compare this to current master:

$ hyperfine 'target/release/kirby example.log.gz'
Benchmark #1: target/release/kirby example.log.gz
  Time (mean ± σ):      4.585 s ±  0.047 s    [User: 4.539 s, System: 0.034 s]
  Range (min … max):    4.530 s …  4.665 s

Looks like this shaves off a whole second!

@indirect

This comment has been minimized.

Copy link
Member

indirect commented Nov 19, 2018

This is great! Thanks. 😁

@indirect indirect merged commit f8953f1 into rubytogether:main Nov 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment