8000 Add printing benchmarks and rearrange some things by travisbrown · Pull Request #544 · circe/circe · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add printing benchmarks and rearrange some things #544

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

Merged
merged 8 commits into from
Jan 16, 2017

Conversation

travisbrown
Copy link
Member

First stab at investigating #542, but the results aren't very surprising / helpful:

Benchmark                                     Mode  Cnt      Score      Error  Units
PrintingBenchmark.printBooleansToByteBuffer  thrpt   20  31892.871 ± 2119.524  ops/s
PrintingBenchmark.printBooleansToString      thrpt   20  37532.772 ± 3550.116  ops/s
PrintingBenchmark.printFoosToByteBuffer      thrpt   20   2839.652 ±  221.515  ops/s
PrintingBenchmark.printFoosToString          thrpt   20   3496.935 ±   39.529  ops/s
PrintingBenchmark.printIntsToByteBuffer      thrpt   20  17816.349 ± 1988.353  ops/s
PrintingBenchmark.printIntsToString          thrpt   20  17039.468 ± 4612.298  ops/s

@vkostyukov
Copy link
Collaborator
vkostyukov commented Jan 12, 2017

It's quite interesting that string-based printing is nearly always better. My guess is byte-buffers are faster when the data set is big enough.

@travisbrown
Copy link
Member Author

Added a small optimization for JSON arrays (Vector#iterator seems a little faster than iterating over indices by hand).

@codecov-io
Copy link
codecov-io commented Jan 12, 2017

Current coverage is 83.16% (diff: 98.80%)

Merging #544 into master will increase coverage by 0.62%

@@             master       #544   diff @@
==========================================
  Files            71         73     +2   
  Lines          1981       2043    +62   
  Methods        1842       1894    +52   
  Messages          0          0          
  Branches        139        148     +9   
==========================================
+ Hits           1635       1699    +64   
+ Misses          346        344     -2   
  Partials          0          0          

Powered by Codecov. Last update 5239b2e...905c23c

@jonas
Copy link
Contributor
jonas commented Jan 13, 2017

@travisbrown I was playing with this yesterday and although it doesn't change anything for the benchmarks I wonder if it would make sense to change Printer.MemoizedPieces to always return the same instance when indent.isEmpty or somehow inject the pieces member so that only one is ever used for the noSpaces case.

@travisbrown
Copy link
Member Author

@jonas Makes sense—I've just pushed a new commit with that and a few other little changes.

@travisbrown travisbrown merged commit 896f734 into master Jan 16, 2017
@travisbrown travisbrown deleted the topic/printing-benchmarks branch April 20, 2017 17:03
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.

4 participants
0