harfbuzz / boring-expansion-spec

Better-Engineered Font Formats; Part 1. Boring Expansion
80 stars 9 forks source link

Larger/faster version of MultiItemVariationData #153

Open behdad opened 1 month ago

behdad commented 1 month ago

The following takes more spec, but is faster to parse, than the existing format1:

struct MultiItemVariationData
{
  uint8 Format; // 2
  uint16 regionIndexCount;
  uint16 regionIndexes[regionIndexCount];
  CFF2IndexOf<float[]> deltaSets;
};
Lorp commented 1 month ago

Please explain the benefit of using float here, rather than int16 or int32.

behdad commented 1 month ago

Please explain the benefit of using float here, rather than int16 or int32.

Good point. I'll measure the runtime and report.

behdad commented 1 month ago

Please explain the benefit of using float here, rather than int16 or int32.

Good point. I'll measure the runtime and report.

I tried int32.

I can measure about 6% speedup using floats. This is because the numbers need to be converted to float and multiplied by a float and added; I also have SIMD codepath for SSE and NEON for the float, but those seem to have very small effect.