swash icon indicating copy to clipboard operation
swash copied to clipboard

Use `usize` for cache keys instead of `u64`.

Open xorgy opened this issue 1 year ago • 5 comments

This improves portability, because AtomicUsize is available on 32-bit targets, but generally AtomicU64 is not.

xorgy avatar Nov 06 '24 17:11 xorgy

From a safety perspective, I think it's much more likely we run out of memory in a 32-bit process, than exhaust usize font IDs or cache keys, so I don't see this being an issue. Please don't try to load four billion fonts on a Raspberry Pi 2, and then file an issue about it...

xorgy avatar Nov 06 '24 17:11 xorgy

I’m happy to use an AtomicUsize counter to better support 32-bit targets but I’d prefer to keep the rest of the API the same to avoid breakage. In particular, the [u64; 2] key type is used by parley to store blob ids from peniko. Not ideal and I think we can do better but that’s future work.

dfrg avatar Nov 06 '24 18:11 dfrg

I can separate the two until we look at a break.

xorgy avatar Nov 06 '24 20:11 xorgy

I've put up #70 for this non-breaking subset. @dfrg

xorgy avatar Nov 06 '24 23:11 xorgy

As main already contains breaking changes, the next Swash release will be breaking anyway. In that light I think including more breaking changes right now makes sense.

Is the Parley/Peniko situation a hard blocker that must be solved first, or can Swash lead the way here?

xStrom avatar Nov 15 '24 12:11 xStrom