From 12d7561d25681551ffb03b2d65d0d26a38639691 Mon Sep 17 00:00:00 2001 From: Project516 <138796702+Project516@users.noreply.github.com> Date: Mon, 23 Nov 2026 14:16:16 -0600 Subject: [PATCH 1/2] perf: leave more codec libraries out of Asyncify in the single-thread core --- CHANGELOG.md | 6 ++++++ build/ffmpeg-wasm.sh | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fc4ba68a8..5c02d96e19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project are documented in this file. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). +## Unreleased + +### Changed + +- The single-thread (Asyncify) core is about 1.5 percent smaller, from leaving more codec libraries out of Asyncify instrumentation. + ## 0.19.0 ### Changed diff --git a/build/ffmpeg-wasm.sh b/build/ffmpeg-wasm.sh index aead1dd5d2..67e21a3986 100755 --- a/build/ffmpeg-wasm.sh +++ b/build/ffmpeg-wasm.sh @@ -72,9 +72,10 @@ else # uses and nothing here calls. Each fiber carries its own asyncify stack # for fiber swaps; see PFIBER_ASYNCIFY_STACK_SIZE in pthread_fiber.c. -sASYNCIFY_STACK_SIZE=65536 - # x264 has no threads here and only calls back to av_log, so no fiber - # switch happens inside it; instrumenting it only slows it down. - "-sASYNCIFY_REMOVE=['x264_*']" + # These libraries have no threads here and only call back to av_log, so no + # fiber switch happens inside them; instrumenting them only costs size and + # speed. libdav1d and libwebp are not listed: -threads N starts threads there. + "-sASYNCIFY_REMOVE=['x264_*','vpx_*','vp8_*','vp9_*','lame_*','opus_*','celt_*','silk_*','vorbis_*','ogg_*','th_*','zimg*','FT_*','hb_*','ass_*','fribidi_*']" ) fi From 36d2a864aebdbe2d2af5b66093b4b6e38abb33c1 Mon Sep 17 00:00:00 2001 From: Project516 <138796702+Project516@users.noreply.github.com> Date: Mon, 23 Nov 2026 14:22:20 -0600 Subject: [PATCH 2/2] fix: keep the vp8 and vp9 prefixes instrumented for Asyncify --- CHANGELOG.md | 2 +- build/ffmpeg-wasm.sh | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c02d96e19..d702d467b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). ### Changed -- The single-thread (Asyncify) core is about 1.5 percent smaller, from leaving more codec libraries out of Asyncify instrumentation. +- The single-thread (Asyncify) core is smaller, from leaving more codec libraries out of Asyncify instrumentation. ## 0.19.0 diff --git a/build/ffmpeg-wasm.sh b/build/ffmpeg-wasm.sh index 67e21a3986..fa3312d54b 100755 --- a/build/ffmpeg-wasm.sh +++ b/build/ffmpeg-wasm.sh @@ -74,8 +74,9 @@ else -sASYNCIFY_STACK_SIZE=65536 # These libraries have no threads here and only call back to av_log, so no # fiber switch happens inside them; instrumenting them only costs size and - # speed. libdav1d and libwebp are not listed: -threads N starts threads there. - "-sASYNCIFY_REMOVE=['x264_*','vpx_*','vp8_*','vp9_*','lame_*','opus_*','celt_*','silk_*','vorbis_*','ogg_*','th_*','zimg*','FT_*','hb_*','ass_*','fribidi_*']" + # speed. libdav1d, libwebp and the vp8_/vp9_ prefixes (FFmpeg's own decoders + # too) are not listed: -threads N makes them start or wait on threads. + "-sASYNCIFY_REMOVE=['x264_*','vpx_*','lame_*','opus_*','celt_*','silk_*','vorbis_*','ogg_*','th_*','zimg*','FT_*','hb_*','ass_*','fribidi_*']" ) fi