-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates scanner to support Lua extension
Fixed up the Scanner logic to mirror changes made to support Lua extension in Lex. Added a compat layer so that the existing Lua type can be used with `Scanner` vs trying to refactor the implementation to remove the channel. Doing so I think would result in further gains. Benchmarks: ``` goarch: arm64 pkg: github.com/nginxinc/nginx-go-crossplane BenchmarkLex/simple-10 61224 18869 ns/op 103049 B/op 39 allocs/op BenchmarkLex/with-comments-10 56320 19776 ns/op 103113 B/op 45 allocs/op BenchmarkLex/messy-10 25918 47312 ns/op 104400 B/op 168 allocs/op BenchmarkLex/quote-behavior-10 72890 15389 ns/op 102960 B/op 26 allocs/op BenchmarkLex/quoted-right-brace-10 44002 27143 ns/op 103561 B/op 54 allocs/op BenchmarkLex/comments-between-args-10 79369 15303 ns/op 102937 B/op 27 allocs/op BenchmarkLexWithLua/lua-basic-10 51590 23743 ns/op 103385 B/op 49 allocs/op BenchmarkLexWithLua/lua-block-simple-10 24564 48282 ns/op 104488 B/op 157 allocs/op BenchmarkLexWithLua/lua-block-larger-10 23427 48567 ns/op 104376 B/op 144 allocs/op BenchmarkLexWithLua/lua-block-tricky-10 33526 36308 ns/op 103896 B/op 117 allocs/op BenchmarkScanner/simple-10 170299 7450 ns/op 4648 B/op 36 allocs/op BenchmarkScanner/with-comments-10 120178 9462 ns/op 4712 B/op 42 allocs/op BenchmarkScanner/messy-10 43105 27796 ns/op 6000 B/op 165 allocs/op BenchmarkScanner/quote-behavior-10 207045 5587 ns/op 4560 B/op 23 allocs/op BenchmarkScanner/quoted-right-brace-10 79261 15685 ns/op 5160 B/op 51 allocs/op BenchmarkScanner/comments-between-args-10 216628 5411 ns/op 4536 B/op 24 allocs/op BenchmarkScannerWithLua/lua-basic-10 80594 15127 ns/op 7867 B/op 66 allocs/op BenchmarkScannerWithLua/lua-block-simple-10 28033 42450 ns/op 10922 B/op 156 allocs/op BenchmarkScannerWithLua/lua-block-larger-10 33932 33655 ns/op 10771 B/op 72 allocs/op BenchmarkScannerWithLua/lua-block-tricky-10 51888 23334 ns/op 9050 B/op 79 allocs/op PASS ok github.com/nginxinc/nginx-go-crossplane 30.055s ```
- Loading branch information
Showing
5 changed files
with
272 additions
and
63 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.