Code Monkey home page Code Monkey logo

Comments (9)

chris-ramon avatar chris-ramon commented on July 21, 2024

Hi @ptomasroos,

Could you link me to the c lib that facebook provides?

from graphql.

ptomasroos avatar ptomasroos commented on July 21, 2024

Hey @chris-ramon

This is the library I meant.

https://github.com/graphql/libgraphqlparser

from graphql.

chris-ramon avatar chris-ramon commented on July 21, 2024

Thanks @ptomasroos !

Definitely we could had figure-out how and depend on the c parser lib and ofc gain all the advantages that brings it.

I think having no dependencies it allow us to move faster, have light-weight lib, and do not have to deal with c-to-go, go-to-c trips.

And we have already a working parser passing all the tests from graphql-js.

from graphql.

ptomasroos avatar ptomasroos commented on July 21, 2024

I think the sad part is that you will loose all the benefits facebook will make to that c library which will receive updates from nodejs, ruby, python and all of the other languages who are doing wrappers around it, plus its a enormous waste of time for you. Not trying to bash on you, its more that:

The moment you loose focus on this the entire community looses because now the entire community stands with a maintainability of something that might accelerate very fast on the source. I've seen this happen to a lot of projects when it comes to specially golang. Where ppl try to port wire formats and do it a "pure-way". CGO is seriously good and one of the biggest benefits i see with golang tbh. The ability to reuse.

What kind of features would ever be needed thats not supported out of the spec? And why wouldnt that be possible to be added on higher level?

There is nothing more reliable and lightweight than a c lib which does memory mgmt in the correct way. I can proove that the lib/pq is 4.000m after the wrapped c library which hasnt been updated for 6 years because there is no errors, no correct fault handling ect.

Its def up to you. But rewriting something will almost never ever make something better if its constrained by the source project anyhow. Just my cents. Not trying to sound like a douche.

CGO is no real problem to day.

from graphql.

ileitch avatar ileitch commented on July 21, 2024

@ptomasroos you realize that lib is only a parser, right? Parsers don't change much.

from graphql.

ptomasroos avatar ptomasroos commented on July 21, 2024

@ileitch Yes. "only" 6-8K ? lines of code covered with tests. I see that as a big value.

from graphql.

sogko avatar sogko commented on July 21, 2024

@ptomasroos brought up some valid points on the benefits of wrapping the c-lib parser.

Right now the implementation of the parser is based on graphql-js parser but it is basically a black-box. The implementation details of the parser can be changed easily (e.g replace it with cgo impementation).

Give it a query string, get an ast struct in return. Simple as that.

I helped @chris-ramon to quickly complete his work on the parser, but I was more interested in writing tests to ensure that it meets the spec, at least in comparison to graphql-js.
Optimizing the parser for memory management and performance could come later, in my mind.

I think right now this project has more parts to it than just the parser i.e, the validator, executor etc, (For me personally, to get a working Relay-compliant server in golang eventually.)

I think if anyone could contribute a PR replacing the parser with a CGO version, that would be awesome. 👍🏻 The tests are already there, so it'll be relatively easy to verify the implementation.

Cheers guys!

from graphql.

ptomasroos avatar ptomasroos commented on July 21, 2024

I'm def looking forward to a good implementation in golang, no questions asked! I just hope that someone can get there in a reasonable amount of time before loosing its urge :)

Good luck, guys. Will check back.

from graphql.

sogko avatar sogko commented on July 21, 2024

A related update to keep this discussion productive:

Someone just released a golang wrapper for libgraphqlparser
https://github.com/tecbot/c-graphqlparser

Seems legit.

Cheers!

from graphql.

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.