-
Notifications
You must be signed in to change notification settings - Fork 43
Small changes for string parsing #140
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
Conversation
@@ -181,16 +179,24 @@ private Token ReadComment() | |||
); | |||
} | |||
|
|||
// TODO: this method can still be optimized no not allocate at all if block string: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Shane32 I am 100% sure that this can be done, but I was not so brave to do it myself :).
Thanks! The spec is fairly tricky to implement correctly in an optimized manner. But I opted for optimization rather than using LINQ or something more readable. I tried to put some comments in the code to help make it understandable. Looking back at it now, I don't like that it uses try..catch to catch an overflow and then handle it. As a general rule of thumb I try not to let any code generate exceptions when no error has occurred for two reasons: it significantly slows down execution of code that does not generate an error (in this case, any blockstrings over 4000 chars), and (2) while debugging user code with 'just my code' turned off, the debugger may break on the exception when no error has truly occurred. If you agree, perhaps you want to modify the PR... up to you. |
Co-authored-by: Shane Krueger <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #140 +/- ##
==========================================
+ Coverage 92.06% 92.66% +0.59%
==========================================
Files 48 49 +1
Lines 2193 2317 +124
Branches 251 273 +22
==========================================
+ Hits 2019 2147 +128
+ Misses 147 143 -4
Partials 27 27
Continue to review full report at Codecov.
|
Your |
Oh. Didn't think I would have done that. Well, sometime we can make an improvement there. |
In fact, I would not worry because of a potential exception handling slowdown. If an exception is happening, then not so often. In addition, the code performed under the |
Waiting a bit for graphql/graphql-spec#899 to verify naming. |
It just really annoys me when I go to debug something, and VS breaks on some internal line of code, which isn't an error. Which just reminds me that there's a significant performance problem whenever that bit of code gets hit. |
I know and understand. |
@Shane32 see graphql/graphql-spec#899 (comment) . Nevertheless, I will keep |
This PR represents a result for the review of #131 . Great job @Shane32 . I did not thoroughly check the entire written code. I confess that it is difficult to read. Many counters, many branches. Nevertheless, the general meaning is well understood. Excellent that you wrote all those tests. In addition to cosmetic edits and comments, I reduced the size of the buffers used on the stack. I do not think that we needed such large buffers.