Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build a parser in C #4368

Merged
merged 16 commits into from
Mar 28, 2023
Merged

Build a parser in C #4368

merged 16 commits into from
Mar 28, 2023

Conversation

rmosolgo
Copy link
Owner

@rmosolgo rmosolgo commented Mar 3, 2023

Like #4366 , this ports the existing parser (racc) into a C extension (using bison).

It looks like it's about 10x faster: After improvements to the Ruby scanner, the C parser is 7-9x faster:

  ~/code/graphql-ruby $ be rake bench:parse
  # ...
  parse - introspection
-                           1.243k (± 8.4%) i/s -      6.174k in   5.005459s
+                          11.068k (± 2.8%) i/s -     55.650k in   5.031916s
-    parse - fragments      1.870k (± 7.0%) i/s -      9.353k in   5.029178s
+    parse - fragments     14.839k (± 6.1%) i/s -     75.168k in   5.086781s
-    parse - big query    222.342  (± 3.6%) i/s -      1.122k in   5.053040s
+    parse - big query      1.670k (± 5.3%) i/s -      8.496k in   5.103380s

As well as less memory:

- Total allocated: 498928 bytes (8187 objects)
+ Total allocated: 318544 bytes (3570 objects)

Base automatically changed from ragel-c-gen to master March 10, 2023 14:53
@rmosolgo rmosolgo added this to the c-parser-1.0.0 milestone Mar 28, 2023
@rmosolgo rmosolgo merged commit 42b3413 into master Mar 28, 2023
13 checks passed
@rmosolgo rmosolgo deleted the yacc-parse branch March 29, 2023 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant