You rewrote this to be faster:
int fastParseOn(String buffer, int position) {
final result = parseOn(Context(buffer, position));
return switch (result) {
Success(position: final position) => position,
Failure() => -1
};
}
I wonder if this might have been fast enough to still use the switch:
int fastParseOn(String buffer, int position) {
final result = parseOn(Context(buffer, position));
return switch (result) {
final Success s => s.position,
Failure _ => -1,
};
}
I understand that might work faster for sorting out types and mapping them to branches. I think Type() goes through a lot of extra work compared to Type _.
You rewrote this to be faster:
I wonder if this might have been fast enough to still use the switch:
I understand that might work faster for sorting out types and mapping them to branches. I think
Type()goes through a lot of extra work compared toType _.