/fast-graphql

An experimental GraphQL implementation with Go. This repo focuses on improve GraphQL Parse and Resolve speed to a new level.

Primary LanguageGoMIT LicenseMIT

fast-graphql

(English | 中文)

Description

fast-graphql is an experimental GraphQL implementation with Golang. This repo focuses on improve GraphQL speed to a new level.

For now, we will try GraphQL JIT, Cache Optimize runtime, Raw-ASM Parser, and SIMD methods to optimize.

WARNING: this repo is under construction, not production-ready.

Performance

In a typical 0.2 KB GraphQL request test (1, 2), the performance comparison between fast-graphql and other GraphQL implementations is as follows:

Benchmark-for-GraphQL-Instance

When using the net/http library, fast-graphql takes up only 38% of the runtime time, with the rest of the overhead being net/http, I/O, Runtime GC, and so on.

This means that better performance can be achieved when using other HTTP libraries, such as fasthttp.

fast-graphql-flamegraph-alpha1

Steps & Objects

  • Prepare.
  • GraphQL Features.
    • GraphQL Lexer & Parser. (✔️)
    • A Minimal Demo with Query Operation. (✔️)
    • GraphQL Features
  • Frontend Optimize
  • Backend Optimize
    • Strings Serialization Optimize. (✔️)
  • Reflect Optimize
  • Serialization/Deserialization Optimize (✔️)
    • Request-Parser. (✔️)
    • Replace encoding/json with result buffer. (✔️)
  • Cache-Policy
    • AST Cache. (✔️)
    • Backend Cache. (✔️)
  • GraphQL JIT
    • ASM Parser Demo. (✔️)
    • JIT Frontend Prototype. ()
    • JIT Backend Prototype. (✔️)
    • function call cause GC kill the progress issue. ()
    • ASM & SIMD Optimize. ()
  • GC & memory Optimize. ()
  • Demo for Usage. ()
  • Test & Testcase. ()

Examples

Documents

Dependency

The basic backend logic of this repo is port from graphql-go, and the lexer & parser are inspired by Lua.

Contributors

License

Reference