[HarfBuzz] caching plans with user features

Behdad Esfahbod behdad at behdad.org
Tue Nov 5 15:12:15 PST 2013


On 13-10-31 07:44 AM, Jonathan Kew wrote:
> On 29/10/13 23:03, Behdad Esfahbod wrote:
>> On 13-10-29 10:10 PM, Jonathan Kew wrote:
>>>
>>> So I'd suggest it's worth doing something like this - unless of course you
>>> want to go the whole way and implement "smart" plan caching with user
>>> features, but IMO that sounds like it might be more effort than it's worth.
>>
>> Thanks Jonathan.  Yes, something along these lines is what I wanted to do.  My
>> only hesitation was that plans are cached indefinitely on the face, but if we
>> only cache global-only plans, I'm still quite comfortable with that.
> 
> I wondered whether perhaps we should limit the number of plans that a face can
> cache - start discarding old plans if the number goes past about 10 or so.
> That would degrade gracefully and avoid uncontrolled growth if a badly-coded
> (or malicious!) site keeps adding random (or duplicated) features to the list,
> but still give the performance boost for any normal use-cases.

Limiting cache size (or really any caching scheme with eviction) cannot be
implemented using just an atomic compare-and-exchange.  So we would either
need double-CAS, and things become really tricky really fast.  Maybe it's just
fine to lock a mutex.  Donno.

Anyway, will get to this eventually.


-- 
behdad
http://behdad.org/



More information about the HarfBuzz mailing list