SixLabors / Fonts

:black_nib: Font loading and layout library.
https://sixlabors.com/products/fonts
Other
313 stars 72 forks source link

Add Bench mark for text render optimized TryGetGlyphMetricsAtOffset #282

Closed Faolan-Rad closed 2 years ago

Faolan-Rad commented 2 years ago

Description

This was me just finds Glyph Metrics when it loads and updates rather then on every TryGetGlyphMetricsAtOffset which improves performance even more

CLAassistant commented 2 years ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Faolan-Rad commented 2 years ago

This is based off this pull request Speed up Unicode Data lookups and remove reflection

JimBobSquarePants commented 2 years ago

Hi @Faolan-Rad thanks for your PR.

To accept this I would have to see two things.

  1. Proof that this area is a processing hotspot and that it requires extra optimization.
  2. Before/After benchmark results showing the improvement from the change.

I would need some convincing to see the usefulness of this change. GlyphPositioningCollection.TryGetGlyphMetricsAtOffset(...) is only called during line breaking which involves a sequential run against the codepoints within the string. This means that a given offset is only requested one time which means any cache lookup will always return false.

JimBobSquarePants commented 2 years ago

Sorry @Faolan-Rad This was auto closed when I merged the base branch. If you still feel like it is required please repoint the PR at the main branch.