Coder Social home page Coder Social logo

Comments (6)

andheiberg avatar andheiberg commented on May 12, 2024

I'm not aware if @dosten is still maintaining this.

I would be interested in discussing your project if you're willing. I work with a team that have invested considerable effort into GraphQL in PHP and would always love to share experience.

On a side note I did start playing with my own PHP extension https://github.com/andheiberg/graphql-parser-php-extension I believe I left in a semi finished state with some edge case errors. I haven't had an incentive to pick it up again though. You should consider that in practical usage caching the results of query parsing means that the efficiency of the query parsing is fairly unimportant. We've yet to open source our works for caching, but could be persuaded to do so if there was an interest for it.

from graphql-parser-php.

crisu83 avatar crisu83 commented on May 12, 2024

@andheiberg we actually decided to write the parser ourselves to ease the adaption of our library. I would definitely be interested in discussing this further with you.

from graphql-parser-php.

fubhy avatar fubhy commented on May 12, 2024

You should consider that in practical usage caching the results of query parsing means that the efficiency of the query parsing is fairly unimportant. We've yet to open source our works for caching, but could be persuaded to do so if there was an interest for it.

I disagree. Yes, there are quite a few scenarios in which query parsing performance becomes less relevant. Most importantly when using persisted queries in which case you definitely want to cache the pre-parse AND pre-validated query ASTs of the persisted queries. Unless however you actually are able to use persisted queries (which is not possible if you have a completely open API for instance), you need to parse all incoming queries. You can cache the results based on a hash of the query string, sure, but a single whitespace difference would cause a cache miss. Hence, at least for one of my use-cases, query string parsing is actually a considerable part of query execution (roughly 10%).

from graphql-parser-php.

andheiberg avatar andheiberg commented on May 12, 2024

You can cache the results based on a hash of the query string, sure, but a single whitespace difference would cause a cache miss.

It's very possible to normalise queries to prevent this. Again we have an internal tool for this. If people are super interested we could look into open sourcing it.

from graphql-parser-php.

fubhy avatar fubhy commented on May 12, 2024

I am super interested. :)

from graphql-parser-php.

vladar avatar vladar commented on May 12, 2024

Hence, at least for one of my use-cases, query string parsing is actually a considerable part of query execution (roughly 10%).

Have you tried using this C-based parser with webonyx's AST::fromArray. It has some overhead on top of a plain associative array, but it should perform much better than existing PHP-based parser anyway.

from graphql-parser-php.

Related Issues (2)

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.