[Webkit-unassigned] [Bug 219285] New: WTF::StringImpl is not thread-safe

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Nov 25 09:06:27 PST 2020


https://bugs.webkit.org/show_bug.cgi?id=219285

            Bug ID: 219285
           Summary: WTF::StringImpl is not thread-safe
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebKit Misc.
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: clord at igalia.com
                CC: koivisto at iki.fi
            Blocks: 219283

It would be useful in many situations to be able to use Strings across multiple threads, especially now that Workers, OffscreenCanvas and GPUProcess have become/are becoming things. Blink has already managed this (I think?), their plan is detailed here: https://docs.google.com/document/d/1hp7h6zfD5S6mnMI4cHe1PpacRnb2rNpRRkn1gBBJHuQ/edit#heading=h.erv1bv18t616

The founding part of making this work is to make ref-counting on WTF::StringImpl atomic. We could then have global string and symbol tables guarded by locks, and remove a bunch of now-unnecessary API. It looks like Google dealt with the performance degradation by optimising the worst-hit areas and adding special API for bulk creation of strings - certainly that latter part seems like a very reasonable idea, to me. Antti has suggested removing destruction from deref and having a separate 'GC' thread to perform periodic destruction to possibly optimise both performance and size - we should probably look at this after seeing the impact without it first.

A rough, high-level plan;

1- Make ref/deref on StringImpl atomic and benchmark impact
2- Make string/symbol table static and guarded by a lock (already the case in some situations)
3- Remove now-unnecessary API (isolatedCopy, StringTableProvider...)
X- Experiment with GC thread as a way of mitigating performance impact of 1/2
X- Identify and optimise badly-impacted areas

I'm going to attempt to have a go at this, given its need in both OffscreenCanvas and GPUProcess. All suggestions/help/discussion appreciated.


Referenced Bugs:

https://bugs.webkit.org/show_bug.cgi?id=219283
[Bug 219283] Make FontCache thread-safe
-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20201125/1553c05d/attachment.htm>


More information about the webkit-unassigned mailing list