mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 10:37:17 +02:00
The Rust FFI requires UTF-16 source data, so ASCII-stored source code must be widened to UTF-16. Previously, this conversion was done into a temporary buffer on every call to compile_function, meaning the entire source file was converted for each lazily-compiled function. For large modules with many functions, this caused heavy spinning. Move the conversion into SourceCode::utf16_data() which lazily converts and caches the result once per source file. Subsequent compilations of functions from the same file reuse the cached data.
1.5 KiB
1.5 KiB