Code Monkey home page Code Monkey logo

Comments (13)

shishirmk avatar shishirmk commented on August 16, 2024 1

Thanks for reaching out. We are putting together a longer writeup. Our benchmarks can be run very easily If you just run rspec you will see the results. More information about how the benchmarks are setup take a look at this file

https://github.com/Netflix/fast_jsonapi/blob/master/spec/lib/object_serializer_performance_spec.rb

We had a very specific goal in mind so we got the speed increase by sacrificing some flexibility, focusing just on JSON API and assuming homogenous lists.

from fast_jsonapi.

ahx avatar ahx commented on August 16, 2024

@shishirmk Thank you for sharing this and thinking about putting together a longer writeout. It would be great if you could add one or two sentences about why fast_jsonapi is faster than AMS. I am very interested in this sort of performance optimization, but I currently have no clue about where to start or what techniques to avoid in order to become/stay fast.

from fast_jsonapi.

minsikzzang avatar minsikzzang commented on August 16, 2024

benchmark against jsonapi-rb added in #52

from fast_jsonapi.

sriniwasgr-zz avatar sriniwasgr-zz commented on August 16, 2024

@NullVoxPopuli @shishirmk Here is the link to the performance doc. Hopefully it helps in answering your question.

from fast_jsonapi.

amitsuryavanshi avatar amitsuryavanshi commented on August 16, 2024

I did some benchmarking with script and results (Iterations per second) were,
Warming up --------------------------------------
jsonapi-rb 10.000 i/100ms
Calculating -------------------------------------
jsonapi-rb 111.401 (±20.6%) i/s - 1.580k in 15.058330s

Warming up --------------------------------------
fastjson-api 118.000 i/100ms
Calculating -------------------------------------
fastjson-api 1.270k (± 9.6%) i/s - 18.880k in 15.014813s

Can someone confirm these results ? Let me know if I am doing anything wrong here. Thanks.

from fast_jsonapi.

shishirmk avatar shishirmk commented on August 16, 2024

@amitsuryavanshi
Here is the benchmark i see on my laptop based on #52 by @minsikzzang

Serialize to Ruby Hash 1000 records
Serializer      Records    Time
AMS serializer  1000       376.51 ms
jsonapi-rb serializer 1000       42.34 ms
Fast serializer 1000       9.8 ms

Serialize to Ruby Hash 250 records
Serializer      Records    Time
AMS serializer  250        89.47 ms
jsonapi-rb serializer 250        8.54 ms
Fast serializer 250        2.09 ms

from fast_jsonapi.

beauby avatar beauby commented on August 16, 2024

I would expect fast_jsonapi to be faster than jsonapi-rb as it is more specialized, but a fair comparison would make jsonapi-rb use Oj as well for JSON serialization.

from fast_jsonapi.

NullVoxPopuli avatar NullVoxPopuli commented on August 16, 2024

@beauby I have some benchmarks here with different scenarios if you're curious: #81

Right now the biggest difference is relationship performance. (in favor of jsonapi-rb)
fast_jsonapi wins the most with flat lists of resources

from fast_jsonapi.

guilleiguaran avatar guilleiguaran commented on August 16, 2024

Switching all the serializers to FastJsonapi::MultiToJson.to_json:

Serialize to JSON string 10000 records
Serializer             Records    Time       Speed Up
Fast serializer        10000      144.85 ms
AMS serializer         10000      3413.27 ms 23.56x ✘
jsonapi-rb serializer  10000      406.75 ms  2.81x ✔
jsonapi-serializers    10000      356.9 ms   2.46x ✔

Serialize to Ruby Hash 10000 records
Serializer             Records    Time       Speed Up
Fast serializer        10000      115.26 ms
AMS serializer         10000      3358.11 ms 29.14x ✔
jsonapi-rb serializer  10000      399.27 ms  3.46x ✔
jsonapi-serializers    10000      303.01 ms  2.63x ✔

from fast_jsonapi.

NullVoxPopuli avatar NullVoxPopuli commented on August 16, 2024

@guilleiguaran do you have code for those benchmarks? they look fishy

from fast_jsonapi.

guilleiguaran avatar guilleiguaran commented on August 16, 2024

@NullVoxPopuli those are the benchmarks shipped with fast_jsonapi, see #96 for my changes.

from fast_jsonapi.

NullVoxPopuli avatar NullVoxPopuli commented on August 16, 2024

ah ok. cool. @guilleiguaran, there are more in-depth benchmarks here, if you want to play with those #81

from fast_jsonapi.

shishirmk avatar shishirmk commented on August 16, 2024

Released as a part of version 1.1.0

from fast_jsonapi.

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.