Julia remove globals#115
Merged
DmitrySoshnikov merged 2 commits intoApr 1, 2022
Merged
Conversation
Owner
|
Perfect, thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removed non-static globals and put them in a structure which is passed, so should not be multithreading safe. Also did some performance optimizations.
Results of optimizations are:
BEFORE:
julia> @benchmark SyntaxParser.parse("5 + 5")
BenchmarkTools.Trial: 10000 samples with 1 evaluation.
Range (min … max): 18.917 μs … 2.400 ms ┊ GC (min … max): 0.00% … 98.15%
Time (median): 20.500 μs ┊ GC (median): 0.00%
Time (mean ± σ): 22.406 μs ± 63.097 μs ┊ GC (mean ± σ): 7.87% ± 2.77%
Memory estimate: 37.61 KiB, allocs estimate: 200.
AFTER:
julia> @benchmark SyntaxParser.parse("5 + 5")
BenchmarkTools.Trial: 10000 samples with 3 evaluations.
Range (min … max): 8.361 μs … 874.167 μs ┊ GC (min … max): 0.00% … 98.16%
Time (median): 9.833 μs ┊ GC (median): 0.00%
Time (mean ± σ): 11.513 μs ± 35.497 μs ┊ GC (mean ± σ): 13.35% ± 4.27%
Memory estimate: 28.77 KiB, allocs estimate: 96.