Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: de9231d86e640102a22bc9a6091eb6dbf94bb4d4
      
https://github.com/WebKit/WebKit/commit/de9231d86e640102a22bc9a6091eb6dbf94bb4d4
  Author: Sosuke Suzuki <[email protected]>
  Date:   2026-08-19 (Wed, 19 Aug 2026)

  Changed paths:
    M Source/JavaScriptCore/runtime/RegExp.cpp
    M Source/JavaScriptCore/runtime/RegExp.h

  Log Message:
  -----------
  [JSC] Use `FixedVector` for `RegExp::m_ovector` and 
`RareData::m_captureGroupNames`
https://bugs.webkit.org/show_bug.cgi?id=322090

Reviewed by Yusuke Suzuki.

Both vectors are sized once in RegExp::finishCreation and never grow, so
Vector's capacity field is wasted. Worse, Vector::resize honors the default
minCapacity of 16, so every RegExp allocated 64 bytes of ovector storage even
though most patterns need 2-8 ints.

Switching to FixedVector shrinks RegExp from 88 to 80 bytes (96 -> 80 byte GC
cell) and allocates exactly offsetVectorSize ints. Per RegExp this is 160 -> 96
bytes of cell + ovector storage as reported by generateHeapSnapshot(), and
maximum RSS with 200,000 live RegExps drops from 137.5 MB to 115.0 MB.

RareData::m_captureGroupNames gets the same treatment, shrinking RareData from
48 to 32 bytes for patterns with named groups.

estimatedSize now reports the exact ovector allocation via byteSize().

* Source/JavaScriptCore/runtime/RegExp.cpp:
(JSC::RegExp::finishCreation):
(JSC::RegExp::estimatedSize):
* Source/JavaScriptCore/runtime/RegExp.h:

Canonical link: https://commits.webkit.org/319495@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to