GithubHelp home page GithubHelp logo

Timings comparaison with Play json about circe HOT 5 CLOSED

circe avatar circe commented on July 22, 2024
Timings comparaison with Play json

from circe.

Comments (5)

ktoso avatar ktoso commented on July 22, 2024

For writing benchmarks please consider using sbt-jmh (it's wrapping OpenJDK's JMH) as it will give more accurate results than running something in a loop or a few times in the repl – there's all kinds of warm-up method JIT-ing and other effects in play here (no pun intended 😉) so it's hard to measure properly without the right infrastructure (i.e. what JMH does around benchmark code).

I'd be very interested in comparing the various libs, but with the right tools :-)
I'm expecting circe to be faster due to it's nature, still curious how much faster.

from circe.

travisbrown avatar travisbrown commented on July 22, 2024

Thanks, @ktoso. We're very happily using your sbt-jmh for circe and Finch's benchmarks, and I'll close this issue when I've added Play JSON to the circe benchmarks (which currently only compare against Argonaut).

(And right, with a little warmup circe looks faster with @crakjie's code.)

from circe.

crakjie avatar crakjie commented on July 22, 2024

Why play json don't have this "problem" ?

from circe.

ktoso avatar ktoso commented on July 22, 2024

Great, thanks @travisbrown :-)

(I've got this knee-jerk reaction when I see hand-rolled benchmarks to recommend proper tools, sorry for the noise 😉)

from circe.

travisbrown avatar travisbrown commented on July 22, 2024

@crakjie There's so much stuff happening in any JVM implementation that you just can't meaningfully compare the performance of operations like this without warmup, etc.

For example, even just running the Play version first pretty much evens things out:

scala> for (i <- 1 to 3 ) { Test.time(play.api.libs.json.Json.toJson(v)) }
 elapsed time :57.044ms
 elapsed time :0.113ms
 elapsed time :0.089ms

scala> for(i <- 1 to 3) { Test.time(v.asJson) }
 elapsed time :61.344ms
 elapsed time :0.067ms
 elapsed time :0.039ms

But this still doesn't really tell you anything.

from circe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.