-
Notifications
You must be signed in to change notification settings - Fork 43
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
Caching #53
Caching #53
Conversation
@joemcbride What do you think about making |
LexerContext public struct -> internal struct
also fixes tests
…cations on caller side Remove SmallSizeOptimizedList add perf summary report
add ConcurrentDictionary cache bump version to 5.0.0 update README
@joemcbride PR is ready for review. The memory traffic gain is about 2 times and the execution time is 15-25 percent less. I bumped the major version of the parser to 5.0.0 as part of the classes became structures. |
@joemcbride If you don't mind I would like to merge this before working on #56 and #57 . |
So we can assume that there is no objection so I merge this PR to use the new parser in graphql-dotnet repo. |
It replaces #50
I continued my experiments and came to the conclusion that performance can be improved by caching strings. It is some sort of "smart local string interning" without actually string allocation. Allocations can be minimized. On the other hand, this requires additional computational load due to the calculation of hashes and comparisons. Nevertheless, there is a tendency towards a total decrease in computational load. I made two cache implementations. Now it’s clear that an implementation with pointers is practically no better than a managed implementation (quite possibly, I wrote it incorrectly). It is given more likely as an example and in the future will most likely be removed from the PR. Another cache implementation for a multi-threaded scenario will also appear. I expect small steps to make changes, gradually increasing performance.
Progress can be seen here: https://github.com/sungam3r/parser/blob/caching/src/GraphQLParser.Benchmarks/GraphQLParser.Benchmarks.Reference.md
Without a doubt, there is still room for improvement.
[UPDATE]: Unsafe code was removed.
Current perf summary report: