Repository navigation
Would avoiding the per-token mapper slice allocation be worthwhile? #482
srinathshrestha
started this conversation in
Ideas
Replies: 1 comment 2 replies
|
If the change is relatively minimal and the code is still clear, no behaviour changes, and there are alloc improvements, I'm open to it. |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
hey, i in the mapping lexer , closure in
Buildcreates a temporarycombined []Mapperfor each token with applicable mappers. i tried benchmarking the actual wrapper locally, with an allocation-free underlying lexer and two identity mappers. that setup gives 16 B/op and 1 alloc/op.i was thinking we could avoid the temporary slice and just loop over the global mappers first, then the token-specific ones. so it'd be just 2 short loops instead of one. so what i'm asking is , will removing that allocation be worth it, any reasons to keep the combined list? wanted to ask before going further.
All reactions