Skip to content

avm2: Add an int*int -> int path to help other fast paths#21255

Merged
Dinnerbone merged 1 commit intoruffle-rs:masterfrom
adrian17:avm2-multiply-ints
Sep 21, 2025
Merged

avm2: Add an int*int -> int path to help other fast paths#21255
Dinnerbone merged 1 commit intoruffle-rs:masterfrom
adrian17:avm2-multiply-ints

Conversation

@adrian17
Copy link
Collaborator

@adrian17 adrian17 commented Aug 7, 2025

This allows array[i1 * i2 + i3] to use an int-indexing fast path, instead of coercing a float to string and then parsing it back.

In #11935 , for me in "generating world" it speeds up from ~4.5s to 2.8s.

This does slightly hurt code that just do regular float multiplies, but it shouldn't be noticeable.

@adrian17 adrian17 force-pushed the avm2-multiply-ints branch from 76a7d7a to a9a68e5 Compare August 7, 2025 19:13
@kjarosh kjarosh added A-avm2 Area: AVM2 (ActionScript 3) T-perf Type: Performance Improvements labels Aug 8, 2025
@evilpie
Copy link
Collaborator

evilpie commented Aug 9, 2025

This might still be an useful optimization in general even after narrowing doubles to ints when possible, because it avoids two integer to double conversions. I sadly don't have any sense for how the type distribution of op_multiply usually looks like, I hope most int * int operations would use op_multiply_i?

This also lead me to: https://github.com/ruffle-rs/ruffle/pull/21255/files#diff-8cbc05c3124304056ca5a9085dd612e6b864dae36aa34133118f7190bfdcfc14R1921 ... are we not handling integer overflow for addition?

@Dinnerbone Dinnerbone enabled auto-merge (rebase) September 21, 2025 09:47
@Dinnerbone Dinnerbone merged commit 219dc69 into ruffle-rs:master Sep 21, 2025
25 checks passed
Hancock33 added a commit to Hancock33/batocera.piboy that referenced this pull request Sep 27, 2025
------------------------------------------------------------------------------------
ares.mk 9e4a00b9680d7c758059c65a04aceb0a6eefcd69 # Version: Commits on Sept 22, 2025
------------------------------------------------------------------------------------
pc-engine-ld: detect and insert a bios hucard when a cd-rom is loaded that depends on it.

Currently non-working because mia rejects non-ld content for LaserActive right now, but it's here for when we fix that!,

------------------------------------------------------------------------------------
cemu.mk 84f12eea65dd185bc7b849303d515d189efb1642 # Version: Commits on Sept 21, 2025
------------------------------------------------------------------------------------
UI: fix sorting after style switch (#1693),

-----------------------------------------------------------------------------------
clk.mk 9261939f62f469cf13a521a5b056d6ea6bdfe7b3 # Version: Commits on Sept 22, 2025
-----------------------------------------------------------------------------------
Switch to working PC for testing.,

-------------------------------------------------------------------------------------------
duckstation.mk 598d393ae9cc86b1c2a3cf701672fce12c1766dc # Version: Commits on Sept 22, 2025
-------------------------------------------------------------------------------------------
System: Don't create any memory cards in PSF/GPU Dump mode,

------------------------------------------------------------------------------------
eden.mk 7050b92d61f2c2be2384f606d47b23d114353944 # Version: Commits on Sept 22, 2025
------------------------------------------------------------------------------------
[vk, gl] fix missing spline1 header (#2551)

--------------------------------------------------------------------------------------
ikemen.mk 1ceb871c66ecbe9ba553d521d3e278c250604fed # Version: Commits on Sept 22, 2025
--------------------------------------------------------------------------------------
Merge pull request #2684 from potsmugen/fix2

fix: index out of range,

---------------------------------------------------------------------------------------
openmsx.mk 21210399d9d3a8937e97bd7c46160c1fd4d6f7a1 # Version: Commits on Sept 22, 2025
---------------------------------------------------------------------------------------
ROMDB Update - Introduced platform for Turbo-R due the Illusion City translation release.

Quibus fixed incorrect 16K mapper entries,

-----------------------------------------------------
pcsx2.mk v2.5.168 # Version: Commits on Sept 21, 2025
-----------------------------------------------------
- [Qt: Add Custom background support](PCSX2/pcsx2#12722)

,

------------------------------------------------------------------------------------
play.mk c666abc24fc03dad7b5955993dbefc9961d4cd04 # Version: Commits on Sept 22, 2025
------------------------------------------------------------------------------------
Update some local scripts.,

--------------------------------------------------------------------------------------
ppsspp.mk 033b21ebfca2aa764d4bd1594b57448a41c4d9ac # Version: Commits on Sept 22, 2025
--------------------------------------------------------------------------------------
Merge pull request #20831 from Silvris/websocket-debug-fix

Websocket Debugger: fix hanging thread,

-------------------------------------------------------------------------------------
rpcs3.mk 29108e1cb4dc884ff88295831aed790278b7e75b # Version: Commits on Sept 21, 2025
-------------------------------------------------------------------------------------
PPU LLVM: Filter out functions with patches,

----------------------------------------------------------------
ruffle.mk nightly-2025-09-22 # Version: Commits on Sept 22, 2025
----------------------------------------------------------------
## What's Changed

* chore: Update translations from Crowdin by @kjarosh in ruffle-rs/ruffle#21720

* core: Merge a subset of NotoSansMath into the built-in NotSans font by @evilpie in ruffle-rs/ruffle#21374

* web: Bump chai from 5.3.1 to 6.0.1 and chai-html from 3.1.0 to 3.2.0 by @torokati44 in ruffle-rs/ruffle#21712

* avm2: Add an int*int -> int path to help other fast paths by @adrian17 in ruffle-rs/ruffle#21255

* extension: Don't run on Kick by @evilpie in ruffle-rs/ruffle#21722

* web: Use title case for context menu entries by @kjarosh in ruffle-rs/ruffle#21726

**Full Changelog**: ruffle-rs/ruffle@nightly-2025-09-21...nightly-2025-09-22,

------------------------------------------------------
ryujinx.mk 1.3.144 # Version: Commits on Sept 22, 2025
------------------------------------------------------
Canary-1.3.144

---------------------------------------------------------------------------------------
shadps4.mk edf0c21505299a3b9bccca1f04959f5f2fab9547 # Version: Commits on Sept 22, 2025
---------------------------------------------------------------------------------------
fix ui,

----------------------------------------------------------------------------------------
thextech.mk d7207ac50e259565973b034e0dc75329c702864e # Version: Commits on Sept 22, 2025
----------------------------------------------------------------------------------------
Translated using Weblate (Japanese)

Currently translated at 100.0% (17 of 17 strings)

Translated using Weblate (Japanese)

Currently translated at 56.0% (381 of 680 strings)

Translated using Weblate (Japanese)

Currently translated at 100.0% (41 of 41 strings)

Translated using Weblate (Japanese)

Currently translated at 11.9% (47 of 393 strings)

Co-authored-by: 3UPPER <mail.3UPPER@gmail.com>

Translate-URL: https://hosted.weblate.org/projects/thextech/android-launcher-arrays/ja/

Translate-URL: https://hosted.weblate.org/projects/thextech/android-launcher-strings/ja/

Translate-URL: https://hosted.weblate.org/projects/thextech/engine-assets-specific/ja/

Translate-URL: https://hosted.weblate.org/projects/thextech/engine-general/ja/

Translation: TheXTech Engine/Android launcher (arrays)

Translation: TheXTech Engine/Android launcher (strings)

Translation: TheXTech Engine/Engine Assets-specific

Translation: TheXTech Engine/Engine General,

------------------------------------------------------------------------------------------
rpi-eeprom.mk dc781dbbf166bff44e8d1be0fd7e9631d726943d # Version: Commits on Sept 22, 2025
------------------------------------------------------------------------------------------
pieeprom-2025-09-22: 2711: Add LZ4 decompressor (latest)

* Add LZ4 decompressor

  LZ4 gives a better compression ratio than the previously used CK compress. The bootloader can now decompress both LZ4 compressed files and CK compressed files.

* rpifwcrypto: Add GET_CRYPTO_PRIVATE_KEY mailbox API

  For provisioning, add a new mailbox API which returns the private key

  in DER format. The API will return an error if the key-status for

  the specified key is LOCKED.

* config: Add support for board_attributes in conditional expressions

  Add support for the board-attributes row in config.txt conditional

  expressions. This can be used to change boot behavior for

  Compute Module Lite / No-WiFi etc.

* board_info: Log the OTP board revision at startup

  Log the board revision plus the raw OTP value at startup.,

-------------------------------------------------------------------------------------
box64.mk 3dfd5bf4b034bcd0fafe570602925e524bc19536 # Version: Commits on Sept 22, 2025
-------------------------------------------------------------------------------------
RV64_DYNAREC] Added more avx scalar opcodes (#3029),

----------------------------------------------------
nblood.mk r14273 # Version: Commits on Sept 22, 2025
----------------------------------------------------
,

---------------------------------------------------------------------------------------
omf2097.mk 87ec56eca7931cacd0fc3fcc31e78acbb19f6545 # Version: Commits on Sept 21, 2025
---------------------------------------------------------------------------------------
Merge pull request #1307 from omf2097/crash-fixes

Prefer crash() instead of abort(),

--------------------------------------------------------------------------------------
openjk.mk e934a3464b624c66649f54c32f7d86c5bd84d22a # Version: Commits on Sept 21, 2025
--------------------------------------------------------------------------------------
Merge pull request #1281 from TwelveEyes/fix-startup-sound

Reorder init to match MP startup,

---------------------------------------------------------------------------------------
stalker.mk d38e7e0c4f0fcd2d699ea47e270f166a9b7aab3f # Version: Commits on Sept 22, 2025
---------------------------------------------------------------------------------------
build(deps): bump Externals/imgui from `1ad9de5` to `5a66d8f` (#1951)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>,

----------------------------------------------------------------------------------------------
theforceengine.mk 4b48c5c3203ed1bdcda667b05cfcd64fd055c00a # Version: Commits on Sept 22, 2025
----------------------------------------------------------------------------------------------
Bug fix - external data needs to be cleared out before loading a game (#569),

----------------------------------------------------------------------------------------------
easyrpg-player.mk 3930a5771764c04ed1534d50b0d0db3086a0f140 # Version: Commits on Sept 22, 2025
----------------------------------------------------------------------------------------------
Merge pull request #3470 from AdamWeb137/language-path

Allow specifying where the languages folder is,

-----------------------------------------------------------------------------------------
retroarch.mk 6c1b32de42fe73890d778006be325c9c593b7d42 # Version: Commits on Sept 22, 2025
-----------------------------------------------------------------------------------------
Make sure correct type is used when calling `retroarch_get_flags()` (#18279),

--------------------------------------------------------------------------------------
libdof.mk 2412e730e887febe7fd73aa2fdde9af2b5576ce8 # Version: Commits on Sept 22, 2025
--------------------------------------------------------------------------------------
ledwiz: fix ledwiz protocol, and add ledwiz and pacdrive64 test tools (#28),

---------------------------------------------------------------------------------------
vpinball.mk 585b9551163d4316ed0a8e5cbe19df469e8503ec # Version: Commits on Jul 23, 2024
---------------------------------------------------------------------------------------
misc: standalone builds for macos, ios, tvos, android, linux, and rpi,

-----------------------------------------------------------------------------------------
doomretro.mk 6897e3267469acc5a392da9009ce0ffe8d4d4881 # Version: Commits on Sept 22, 2025
-----------------------------------------------------------------------------------------
Update releasenotes.md,

-------------------------------------------------------------------------------------------
xash3d-fwgs.mk d073218df07cfc0e4fbf44ec55c1df841368ff9b # Version: Commits on Sept 22, 2025
-------------------------------------------------------------------------------------------
3rdparty: mainui: update,

-------------------------------------------------------------------------------------------------------
libretro-doublecherrygb.mk d55b04eb7195cd03ac935be529412e1a3f9a29f5 # Version: Commits on Sept 22, 2025
-------------------------------------------------------------------------------------------------------
��Revert Apu Changes (for now),

------------------------------------------------------------------------------------------------
libretro-easyrpg.mk 3930a5771764c04ed1534d50b0d0db3086a0f140 # Version: Commits on Sept 22, 2025
------------------------------------------------------------------------------------------------
Merge pull request #3470 from AdamWeb137/language-path

Allow specifying where the languages folder is,

------------------------------------------------------------------------------------------------------
libretro-genesisplusgx.mk 075f18f57f7fb2e47bf9e7076f924f956e685c99 # Version: Commits on Sept 22, 2025
------------------------------------------------------------------------------------------------------
[Core/VDP] improved interlaced mode 2 vertical scrolling accuracy (verified on real hardware),

-----------------------------------------------------------------------------------------------
libretro-ppsspp.mk 033b21ebfca2aa764d4bd1594b57448a41c4d9ac # Version: Commits on Sept 22, 2025
-----------------------------------------------------------------------------------------------
Merge pull request #20831 from Silvris/websocket-debug-fix

Websocket Debugger: fix hanging thread,

----------------------------------------------------------------------------------------------
libretro-wasm4.mk aaa77f4402e4ff467ebac92882ba00ddf4a2d709 # Version: Commits on Sept 22, 2025
----------------------------------------------------------------------------------------------
Merge pull request #836 from catmeow72/add-run-web-step-to-zig

Add a run-web step to the Zig build file,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-avm2 Area: AVM2 (ActionScript 3) T-perf Type: Performance Improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants