Try re-numbering field type constants to use jump tables in type case switches
Open
perf
- Dominant language
- Dart
- Stars
- 572
- Forks
- 196
- Avg merge
- 1h 59m
- Merged PRs (30d)
- 2
Description
This was originally discussed in #756.
With [SDK cl/256180][1], the compiler started to generate a binary search or jump tables for `switch` statements. Before the CL `switch` was compiled to linear scan of alternatives.
With the current implementation of field types, range of the integers being checked are quite large, so the compiler cannot generate a jump table and generates binary search.
We should try re-numbering the type constants to consecutive integers so that the compiler will be able to generate jump tables instead, and then benchmark it.
[1]: https://dart-review.googlesource.com/c/sdk/+/256180
Contributor guide
Assessment
This issue has not been assessed yet.