buildscripts
buildscripts copied to clipboard
Apply Pixman WASM SIMD Patch
Problem is that WASM SIMD support is still a bit experimental and most browsers got it in 2022. So is imo risky to roll this out as it will break likely on some devices.
There is this patch by libreoffice: https://cgit.freedesktop.org/libreoffice/core/commit/?id=d5f5f0984510d6c1b453e31c1ad58fb29fed278b
And here some benchmarks:
~~lol. nope. Better luck next time~~ node provided by emscripten is too old. System Node works >.>
RuntimeError: Aborted(CompileError: WebAssembly.instantiate():
Compiling function #41284:"_pixman_compute_composite_region32" failed:
invalid simd opcode @+7672059)
I marked the interesting ones with a <-
. Top: No SIMD. Bottom: SIMD
Bitmap:
Unfortunately the normal Blit does not become faster :/. This is the typical operation.
------------------------------------------------------------------------
Benchmark Time CPU Iterations
------------------------------------------------------------------------
BM_FindFormatSingle 6.22 ns 6.22 ns 111794665
BM_FindFormat 23.7 ns 23.7 ns 29602334
BM_ComputeImageOpacity 25185 ns 25185 ns 27740 <-
BM_ComputeImageOpacityChipset 62613 ns 62613 ns 11134 <-
BM_Create 12401 ns 12401 ns 56128
BM_Blit 43057 ns 43057 ns 16243
BM_BlitFast 23854 ns 23854 ns 29167
BM_TiledBlit 364 ns 364 ns 1922473
BM_TiledBlitOffset 6786 ns 6786 ns 102803
BM_StretchBlit 62384 ns 62384 ns 11198
BM_StretchBlitRect 62219 ns 62219 ns 11224
BM_FlipBlit 62320 ns 62320 ns 11207
BM_ZoomOpacityBlit 3820 ns 3820 ns 183017
BM_RotateZoomOpacityBlit 4078 ns 4078 ns 171257
BM_WaverBlit 155964 ns 155964 ns 4485 <-
BM_Fill 25066 ns 25066 ns 27915 <-
BM_FillRect 293335 ns 293335 ns 2382 <-
BM_Clear 12309 ns 12309 ns 56928
BM_ClearRect 25110 ns 25110 ns 27890 <-
BM_HueChangeBlit 751022 ns 751022 ns 935 <-
BM_ToneBlit 125215 ns 125215 ns 5590
BM_BlendBlit 431912 ns 431912 ns 1614 <-
BM_Flip 66692 ns 66692 ns 10486
BM_MaskedBlit 492941 ns 492941 ns 1420 <-
BM_MaskedColorBlit 388289 ns 388289 ns 1800 <-
BM_Blit2x 38527 ns 38527 ns 18163
BM_TransformRectangle 86.0 ns 86.0 ns 8136947
BM_EffectsBlit 150537 ns 150537 ns 4368 <-
------------------------------------------------------------------------
Benchmark Time CPU Iterations
------------------------------------------------------------------------
BM_FindFormatSingle 6.16 ns 6.16 ns 113345317
BM_FindFormat 23.6 ns 23.6 ns 29618854
BM_ComputeImageOpacity 7474 ns 7474 ns 94677 <-
BM_ComputeImageOpacityChipset 35757 ns 35757 ns 19544 <-
BM_Create 12144 ns 12144 ns 57417
BM_Blit 43108 ns 43108 ns 16242
BM_BlitFast 23532 ns 23532 ns 29834
BM_TiledBlit 364 ns 364 ns 1920530
BM_TiledBlitOffset 6776 ns 6776 ns 103035
BM_StretchBlit 62228 ns 62228 ns 11196
BM_StretchBlitRect 62181 ns 62181 ns 11252
BM_FlipBlit 62331 ns 62331 ns 11226
BM_ZoomOpacityBlit 3804 ns 3804 ns 183853
BM_RotateZoomOpacityBlit 4085 ns 4085 ns 171303
BM_WaverBlit 144637 ns 144637 ns 4838 <-
BM_Fill 9979 ns 9979 ns 70038 <-
BM_FillRect 120635 ns 120635 ns 5785 <-
BM_Clear 12000 ns 12000 ns 58375
BM_ClearRect 9965 ns 9965 ns 69936 <-
BM_HueChangeBlit 426308 ns 426308 ns 1665 <-
BM_ToneBlit 124925 ns 124926 ns 5599
BM_BlendBlit 188520 ns 188520 ns 3716 <-
BM_Flip 66193 ns 66193 ns 10576
BM_MaskedBlit 181776 ns 181776 ns 3975 <-
BM_MaskedColorBlit 144807 ns 144807 ns 4824 <-
BM_Blit2x 38458 ns 38458 ns 18189
BM_TransformRectangle 86.1 ns 86.1 ns 8135229
BM_EffectsBlit 144725 ns 144725 ns 4600 <-
Draw:
(Crashes with out of memory in both builds)
Font:
----------------------------------------------------------
Benchmark Time CPU Iterations
----------------------------------------------------------
BM_FontSizeStr 3000 ns 3000 ns 232883
BM_FontSizeChar 62.3 ns 62.3 ns 11231302
BM_vRender 195 ns 195 ns 3584303
BM_Render 8427 ns 8427 ns 79988 <-
----------------------------------------------------------
Benchmark Time CPU Iterations
----------------------------------------------------------
BM_FontSizeStr 3006 ns 3006 ns 232460
BM_FontSizeChar 62.3 ns 62.3 ns 11227807
BM_vRender 188 ns 188 ns 3728400
BM_Render 7214 ns 7214 ns 96501 <-
Pixel Format:
Interestingly ARGB and ABGR become twice as fast but we already figured this out years ago and use RGBA and BGRA by default.
--------------------------------------------------------
Benchmark Time CPU Iterations
--------------------------------------------------------
BM_BlitBGRA_a 43159 ns 43159 ns 16222
BM_BlitRGBA_a 43076 ns 43076 ns 16249
BM_BlitABGR_a 208881 ns 208881 ns 3366 <-
BM_BlitARGB_a 410677 ns 410677 ns 1706 <-
BM_BlitBGRA_n 23190 ns 23190 ns 30179
BM_BlitRGBA_n 23203 ns 23203 ns 30199
BM_BlitABGR_n 157621 ns 157622 ns 4454
BM_BlitARGB_n 23233 ns 23233 ns 29990
--------------------------------------------------------
Benchmark Time CPU Iterations
--------------------------------------------------------
BM_BlitBGRA_a 43074 ns 43074 ns 16249
BM_BlitRGBA_a 43125 ns 43125 ns 16234
BM_BlitABGR_a 130252 ns 130252 ns 5308 <-
BM_BlitARGB_a 148160 ns 148160 ns 4688 <-
BM_BlitBGRA_n 23426 ns 23426 ns 29832
BM_BlitRGBA_n 23398 ns 23398 ns 29877
BM_BlitABGR_n 60078 ns 60078 ns 11441
BM_BlitARGB_n 23456 ns 23456 ns 29836
Text:
------------------------------------------------------------------
Benchmark Time CPU Iterations
------------------------------------------------------------------
BM_TextDrawStrSystem 334333 ns 334334 ns 2085 <-
BM_TextDrawStrColor 146541 ns 146541 ns 4754 <-
BM_TextDrawCharSystem 8454 ns 8454 ns 83365 <-
BM_TextDrawCharSystemEx 14.5 ns 14.5 ns 48445341
BM_TextDrawCharColor 3506 ns 3506 ns 200249 <-
BM_TextDrawCharColorEx 8.70 ns 8.70 ns 80582626
------------------------------------------------------------------
Benchmark Time CPU Iterations
------------------------------------------------------------------
BM_TextDrawStrSystem 285243 ns 285243 ns 2423 <-
BM_TextDrawStrColor 128538 ns 128538 ns 5430 <-
BM_TextDrawCharSystem 7254 ns 7254 ns 96237 <-
BM_TextDrawCharSystemEx 14.5 ns 14.5 ns 48438472
BM_TextDrawCharColor 3189 ns 3189 ns 226936 <-
BM_TextDrawCharColorEx 8.69 ns 8.69 ns 80346327