Added a Next method to the Lexer (which avoids allocations) as an alternative to Scan (which provides more debugging info) - #148
Closed
awalterschulze wants to merge 1 commit into
Closed
awalterschulze wants to merge 1 commit into
awalterschulze wants to merge 1 commit into
Conversation
Added a benchmark to show how there are now no allocations as part of Next ``` mail % go test -v --test.bench=. === RUN TestScan1 --- PASS: TestScan1 (0.00s) === RUN TestNext1 --- PASS: TestNext1 (0.00s) === RUN TestScan2 --- PASS: TestScan2 (0.00s) === RUN TestNext2 --- PASS: TestNext2 (0.00s) goos: darwin goarch: arm64 pkg: github.com/goccmack/gocc/example/mail cpu: Apple M4 Pro BenchmarkScan BenchmarkScan-14 3863421 294.4 ns/op 240 B/op 3 allocs/op BenchmarkNext BenchmarkNext-14 5198650 234.3 ns/op 0 B/op 0 allocs/op PASS ```
Collaborator
Author
|
This is not necessary we can just copy these methods beside the Lexer for faster lexing, we do not need to generate them. |
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.
Added a benchmark to show how there are now no allocations as part of Next, see example/mail/parser_test.go
The idea is that this can be used for high performance validation