ARMeilleure: replace else-ifs with switch statements #124

Closed
LukeWarnut wants to merge 1 commits from switch-st into master
LukeWarnut commented 2024-10-31 13:48:49 +00:00 (Migrated from github.com)

This PR replaces several if/else if/else statements with switch statements across ARMeilleure. This should result in a very minor performance increase in some CPU/PPTC-related tasks.

I've tested several games with no issues, but further testing is welcome.

This PR replaces several if/else if/else statements with switch statements across ARMeilleure. This should result in a very minor performance increase in some CPU/PPTC-related tasks. I've tested several games with no issues, but further testing is welcome.
github-actions[bot] commented 2024-10-31 13:57:21 +00:00 (Migrated from github.com)
Download the artifacts for this pull request: * [ryujinx-Release-1.2.0+ac75746-linux_arm64](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2128458986.zip) * [ryujinx-Release-1.2.0+ac75746-linux_x64](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2128467491.zip) * [ryujinx-Release-1.2.0+ac75746-macos_universal](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2128479601.zip) * [ryujinx-Release-1.2.0+ac75746-win_x64](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2128490073.zip) <details><summary>GUI-less (SDL2)</summary> * [sdl2-ryujinx-headless-Release-1.2.0+ac75746-linux_arm64](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2128459165.zip) * [sdl2-ryujinx-headless-Release-1.2.0+ac75746-linux_x64](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2128467765.zip) * [sdl2-ryujinx-headless-Release-1.2.0+ac75746-macos_universal](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2128479786.zip) * [sdl2-ryujinx-headless-Release-1.2.0+ac75746-win_x64](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2128490334.zip) </details> <details><summary>Only for Developers</summary> * [ryujinx-Debug-1.2.0+ac75746-linux_arm64](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2128459909.zip) * [sdl2-ryujinx-headless-Debug-1.2.0+ac75746-linux_arm64](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2128460084.zip) * [ryujinx-Debug-1.2.0+ac75746-linux_x64](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2128471328.zip) * [sdl2-ryujinx-headless-Debug-1.2.0+ac75746-linux_x64](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2128471549.zip) * [ryujinx-Debug-1.2.0+ac75746-macos_universal](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2128478416.zip) * [sdl2-ryujinx-headless-Debug-1.2.0+ac75746-macos_universal](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2128478608.zip) * [ryujinx-Debug-1.2.0+ac75746-win_x64](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2128489787.zip) * [sdl2-ryujinx-headless-Debug-1.2.0+ac75746-win_x64](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2128490206.zip) </details>
Digote commented 2024-11-06 20:35:09 +00:00 (Migrated from github.com)

Great job! I’ll add some tests to check if there’s been any regression.

Setup

Ryzen 5 5600
32GB - 3200Mhz
RTX 4060ti - Driver 566.03


Pokémon Legends: Arceus(1.1.1.)

MAIN(1.2.72)

https://github.com/user-attachments/assets/bf00bd1e-a1f4-4b41-9bc7-7e9ab7f20f52

PR-124

https://github.com/user-attachments/assets/044f7264-5c03-4030-b825-523e3542dd28


I will add more games later.

MAINTAINER EDIT: These videos are h.265 encoded and seemingly only viewable in Chromium-based browsers, or via downloading & watching with a program that can handle h.265.

EDIT 2: I uploaded it again with h.264

Great job! I’ll add some tests to check if there’s been any regression. Setup Ryzen 5 5600 32GB - 3200Mhz RTX 4060ti - Driver 566.03 --------------------------------------------------------------------------------------- **Pokémon Legends: Arceus(1.1.1.)** **MAIN(1.2.72)** https://github.com/user-attachments/assets/bf00bd1e-a1f4-4b41-9bc7-7e9ab7f20f52 **PR-124** https://github.com/user-attachments/assets/044f7264-5c03-4030-b825-523e3542dd28 _________________________________________________________________________________ I will add more games later. MAINTAINER EDIT: These videos are h.265 encoded and seemingly only viewable in Chromium-based browsers, or via downloading & watching with a program that can handle h.265. EDIT 2: I uploaded it again with h.264
Julienraptor01 commented 2024-11-06 21:15:43 +00:00 (Migrated from github.com)

MAINTAINER EDIT: These videos are h.265 encoded and seemingly only viewable in Chromium-based browsers, or via downloading & watching with a program that can handle h.265.

Note

The problem is actually not the H.265, but the Microsoft Media Foundation (MF) CDM (Content Decryption Module) DRM
The video was likely recorded with a Microsoft tool instead of smth clean like OBS

> MAINTAINER EDIT: These videos are h.265 encoded and seemingly only viewable in Chromium-based browsers, or via downloading & watching with a program that can handle h.265. > [!NOTE] > The problem is actually not the H.265, but the Microsoft Media Foundation (MF) CDM (Content Decryption Module) DRM > The video was likely recorded with a Microsoft tool instead of smth clean like OBS
extherian commented 2024-11-06 21:18:38 +00:00 (Migrated from github.com)

It would be great to see this merged, but we're still waiting on the sparse jit pr, which hasn't yet been tested to Greem's satisfaction, I imagine this will have to be tested just as thoroughly. I will do another reddit testing thread once the sparse jit has been merged.

It would be great to see this merged, but we're still waiting on the sparse jit pr, which hasn't yet been tested to Greem's satisfaction, I imagine this will have to be tested just as thoroughly. I will do another reddit testing thread once the sparse jit has been merged.
Digote commented 2024-11-06 21:39:20 +00:00 (Migrated from github.com)

MAINTAINER EDIT: These videos are h.265 encoded and seemingly only viewable in Chromium-based browsers, or via downloading & watching with a program that can handle h.265.

Note

The problem is actually not the H.265, but the Microsoft Media Foundation (MF) CDM (Content Decryption Module) DRM The video was likely recorded with a Microsoft tool instead of smth clean like OBS

Very strange, I used OBS Studio to record and Handbrake to convert it to h.265 and reduce the file size.

> > MAINTAINER EDIT: These videos are h.265 encoded and seemingly only viewable in Chromium-based browsers, or via downloading & watching with a program that can handle h.265. > > Note > > The problem is actually not the H.265, but the Microsoft Media Foundation (MF) CDM (Content Decryption Module) DRM The video was likely recorded with a Microsoft tool instead of smth clean like OBS Very strange, I used OBS Studio to record and Handbrake to convert it to h.265 and reduce the file size.
sokennethwasall commented 2024-11-10 11:50:20 +00:00 (Migrated from github.com)

Tested Super Smash Bro's & Echos of Wisdom on M4 Max Macbook Pro. Both seemed to run well

Tested Super Smash Bro's & Echos of Wisdom on M4 Max Macbook Pro. Both seemed to run well
bangfire commented 2024-11-10 14:10:15 +00:00 (Migrated from github.com)

Have you profiled this to check that the JIT is not already performing any relevant optimizations or is this just something that is suggested by IDE? As most of these contain very few potential branches, I'm unsure if the runtime would not simply lower this into identical IL.

Have you profiled this to check that the JIT is not already performing any relevant optimizations or is this just something that is suggested by IDE? As most of these contain very few potential branches, I'm unsure if the runtime would not simply lower this into identical IL.
GreemDev commented 2024-11-28 22:54:56 +00:00 (Migrated from github.com)

I'm pretty sure these changes are mostly redundant. the .NET compiler is very smart about converting ifs that would be more performant as switches into switches, and also the other way around; needless switches that would be faster as ifs.

as a result I'm going to reject this.

I'm pretty sure these changes are mostly redundant. the .NET compiler is very smart about converting `if`s that would be more performant as `switch`es into `switch`es, and also the other way around; needless switches that would be faster as i`f`s. as a result I'm going to reject this.

Pull request closed

Sign in to join this conversation.
No description provided.