GithubHelp home page GithubHelp logo

Comments (10)

vladar avatar vladar commented on April 27, 2024

СС @yaacovCR

from graphql-js.

yaacovCR avatar yaacovCR commented on April 27, 2024

Are you comparing latest main to https://www.npmjs.com/package/graphql/v/17.0.0-alpha.3 or to v16.x?

from graphql-js.

yaacovCR avatar yaacovCR commented on April 27, 2024

If you are available to walk me through your benchmark and how you have excluded collectfields/buildfieldplan => as far as I can tell that’s mostly what changed from alpha 3

from graphql-js.

freiksenet avatar freiksenet commented on April 27, 2024

Our GraphQL executor is based on graphql-js, latest update that added defer/stream was based on alpha.3 that had no regressions. When I ported the latest code that was added in main it became significantly slower. I then measure the latest main and it was the same regression in graphql-js.

Here is our benchmark suite (execution is the only important one for this):
https://github.com/microsoft/graphitation/tree/main/packages/supermassive/src/benchmarks

from graphql-js.

yaacovCR avatar yaacovCR commented on April 27, 2024

Our GraphQL executor is based on graphql-js, latest update that added defer/stream was based on alpha.3 that had no regressions. When I ported the latest code that was added in main it became significantly slower. I then measure the latest main and it was the same regression in graphql-js.

Here is our benchmark suite (execution is the only important one for this): https://github.com/microsoft/graphitation/tree/main/packages/supermassive/src/benchmarks

That’s very helpful. I hope to have time to look into this.

from graphql-js.

yaacovCR avatar yaacovCR commented on April 27, 2024

These are my results using your benchmarks for graphql-js only on my machine, not scientific, but seems to show the problem is between alpha-2 and alpha-3. I ran the benchmarks x2 each for main, alpha-3, alpha-2....

More investigation to follow....

I am also curious how you pinpointed that the problem is outside collectFields / buildFieldPlan.

main

Query parsing
graphql-js x 119,524 ops/sec ±5.70% (66 runs sampled)
Query Running
graphql-js - string queries x 36,796 ops/sec ±3.26% (76 runs sampled)
graphql-js - parsed queries x 65,519 ops/sec ±2.22% (80 runs sampled)

Query parsing
graphql-js x 123,590 ops/sec ±5.93% (64 runs sampled)
Query Running
graphql-js - string queries x 41,672 ops/sec ±1.62% (79 runs sampled)
graphql-js - parsed queries x 71,277 ops/sec ±1.21% (81 runs sampled)

alpha3

Query parsing
graphql-js x 121,244 ops/sec ±6.78% (66 runs sampled)
Query Running
graphql-js - string queries x 38,568 ops/sec ±1.89% (76 runs sampled)
graphql-js - parsed queries x 64,601 ops/sec ±1.56% (79 runs sampled)

Query parsing
graphql-js x 126,291 ops/sec ±5.05% (65 runs sampled)
Query Running
graphql-js - string queries x 39,484 ops/sec ±1.31% (78 runs sampled)
graphql-js - parsed queries x 66,810 ops/sec ±0.97% (82 runs sampled)

alpha2

Query parsing
graphql-js x 128,254 ops/sec ±5.07% (68 runs sampled)
Query Running
graphql-js - string queries x 49,546 ops/sec ±2.53% (73 runs sampled)
graphql-js - parsed queries x 112,815 ops/sec ±1.70% (79 runs sampled)

Query parsing
graphql-js x 126,365 ops/sec ±5.34% (68 runs sampled)
Query Running
graphql-js - string queries x 48,240 ops/sec ±3.08% (72 runs sampled)
graphql-js - parsed queries x 113,762 ops/sec ±1.25% (81 runs sampled)

from graphql-js.

yaacovCR avatar yaacovCR commented on April 27, 2024

Just to point out the initially obvious, the major change between the alphas was the introduction of deduplicated incremental delivery.

from graphql-js.

yaacovCR avatar yaacovCR commented on April 27, 2024

looks like #4026 improves performance on alpha3 in the direction of alpha2 (note that today my machine is overall smaller, compare to below runs for alpha.2 and alpha.3 rather than the above ops/sec).

definitely might be further room for improvement there!

(would be great if we could get benchmarking into the PR checks/workflow)

graphql@17.0.0-alpha.3.canary.pr.4026.5922420b3b235970ee230497190e28c8290c8f16 (#4026)
Query parsing
graphql-js x 79,078 ops/sec ±4.41% (63 runs sampled)
Query Running
graphql-js - string queries x 21,023 ops/sec ±2.66% (66 runs sampled)
graphql-js - parsed queries x 36,197 ops/sec ±2.56% (64 runs sampled)

alpha.3
Query parsing
graphql-js x 83,228 ops/sec ±4.85% (63 runs sampled)
Query Running
graphql-js - string queries x 18,558 ops/sec ±3.17% (61 runs sampled)
graphql-js - parsed queries x 27,912 ops/sec ±2.05% (67 runs sampled)

alpha2
Query parsing
graphql-js x 81,141 ops/sec ±4.05% (63 runs sampled)
Query Running
graphql-js - string queries x 23,374 ops/sec ±3.77% (55 runs sampled)
graphql-js - parsed queries x 43,548 ops/sec ±2.09% (70 runs sampled)

from graphql-js.

yaacovCR avatar yaacovCR commented on April 27, 2024

further improved performance with latest canary #4026 (comment)

-- but still not as good as alpha.2

from graphql-js.

yaacovCR avatar yaacovCR commented on April 27, 2024

Hi @freiksenet and @vladar!

Are you able to test again with your benchmarks using the latest canary release from #4026 (comment)

...on my machine this latest canary essentially pulls even with alpha.2

It is also at the limit of my ideas about how to improve further.

Thanks so much for opening this issue!

from graphql-js.

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.