dnfield / dart_path_parsing

MIT License
27 stars 8 forks source link

Improve path_parsing performance. #6

Closed jefflim-google closed 3 years ago

jefflim-google commented 3 years ago

This code:

String.codeUnits on both JS and VM returns a forwarding CodeUnits, so all lookups to codeUnits[index] actually go through an extra layer of dispatch.

Combined, all of these changes improve the parsing speed by ~25% when measured with real SVG path data.

parseSvgPathData() timing, measured on a Nexus 2 downclocked to 1GHz.

Before: Run1: 76,124,392 us Run2: 75,103,426 us Run3: 75,481,128 us

After: Run1: 59,319,622 us Run2: 58,435,315 us Run3: 58,478,007 us

jefflim-google commented 3 years ago

Thanks!