Skip to content

[GStreamer] Load Flite when speech synthesis is first used instead of linking it - #77409

Open
TingPing wants to merge 1 commit into
WebKit:mainfrom
TingPing:pgriffis/flite-dlopen
Open

TingPing wants to merge 1 commit into
WebKit:mainfrom
TingPing:pgriffis/flite-dlopen

Conversation

@TingPing

@TingPing TingPing commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

243c31d

[GStreamer] Load Flite when speech synthesis is first used instead of linking it
https://bugs.webkit.org/show_bug.cgi?id=327957

Reviewed by NOBODY (OOPS!).

Linking Flite put its 13 libraries in every WebKit process. One voice that
WebKit doesn't even use, cmu_time_awb, has over 31,000 symbol relocations
against itself, about half of all the symbol bindings the dynamic linker
does when a WebKit process starts. Each of those lookups searches the global
scope of 168 libraries.

Load the Flite libraries and the four voices WebKit uses with dlopen() the
first time speech synthesis needs them, and call Flite through the resolved
functions. Without Flite at runtime, speech synthesis now offers no voices
instead of crashing.

A bare WPEWebProcess goes from 34 ms to 22 ms from exec to exit, and from
168 to 154 libraries.

* Source/WebCore/platform/GStreamer.cmake:
* Source/WebCore/platform/gstreamer/GUniquePtrFlite.h:
* Source/WebCore/platform/gstreamer/WebKitFliteSourceGStreamer.cpp:
(fliteSymbol):
(fliteLibrary):
(WebCore::fliteDeleteVoice):
(WebCore::fliteDeleteWave):
(webkitFliteSrcCreate):
(fliteVoices):
(ensureFliteVoicesInitialized):
(webKitFliteSrcSetUtterance):
(WTF::toArray): Deleted.

243c31d

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ✅ 🧪 win-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
✅ 🧪 ios-wk2-wpt ⏳ 🧪 api-mac-debug
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk3-gcc
✅ 🛠 ios-safer-cpp ✅ 🧪 mac-AS-debug-wk2 ✅ 🛠 gtk
✅ 🛠 vision ✅ 🧪 gtk-wk2
✅ 🛠 vision-sim ⏳ 🧪 mac-intel-wk2 ✅ 🧪 api-gtk
✅ 🧪 vision-wk2 ✅ 🛠 mac-safer-cpp ✅ 🛠 playstation
✅ 🛠 tv ✅ 🧪 mac-site-isolation
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@TingPing TingPing self-assigned this Oct 17, 2026
@TingPing TingPing added WebKitGTK Bugs related to the Gtk API layer. GLib Suggested Backport - 2.54 Suggest this merge request be backported to webkitglib/2.54 branch labels Oct 17, 2026
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Oct 17, 2026
… linking it

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

Reviewed by NOBODY (OOPS!).

Linking Flite put its 13 libraries in every WebKit process. One voice that
WebKit doesn't even use, cmu_time_awb, has over 31,000 symbol relocations
against itself, about half of all the symbol bindings the dynamic linker
does when a WebKit process starts. Each of those lookups searches the global
scope of 168 libraries.

Load the Flite libraries and the four voices WebKit uses with dlopen() the
first time speech synthesis needs them, and call Flite through the resolved
functions. Without Flite at runtime, speech synthesis now offers no voices
instead of crashing.

A bare WPEWebProcess goes from 34 ms to 22 ms from exec to exit, and from
168 to 154 libraries.

* Source/WebCore/platform/GStreamer.cmake:
* Source/WebCore/platform/gstreamer/GUniquePtrFlite.h:
* Source/WebCore/platform/gstreamer/WebKitFliteSourceGStreamer.cpp:
(fliteSymbol):
(fliteLibrary):
(WebCore::fliteDeleteVoice):
(WebCore::fliteDeleteWave):
(webkitFliteSrcCreate):
(fliteVoices):
(ensureFliteVoicesInitialized):
(webKitFliteSrcSetUtterance):
(WTF::toArray): Deleted.
@TingPing TingPing removed the merging-blocked Applied to prevent a change from being merged label Oct 17, 2026
@TingPing
TingPing force-pushed the pgriffis/flite-dlopen branch from 851d97d to 243c31d Compare October 17, 2026 21:50
@TingPing
TingPing marked this pull request as ready for review October 17, 2026 22:19
@TingPing
TingPing requested a review from philn as a code owner October 17, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GLib Suggested Backport - 2.54 Suggest this merge request be backported to webkitglib/2.54 branch WebKitGTK Bugs related to the Gtk API layer.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants