Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slower due to Ipad iOS 17.4 #43

Open
BeezBumba opened this issue Mar 7, 2024 · 46 comments
Open

Slower due to Ipad iOS 17.4 #43

BeezBumba opened this issue Mar 7, 2024 · 46 comments

Comments

@BeezBumba
Copy link

When I updated my Ipad to 17.4 I went to my remixed emulator of yours and it started to lag much more than last time. I even tried yours, but it still resulted into a really laggy experience. I don’t know if it’s the update or if it’s something else.

@BeezBumba
Copy link
Author

I was also on safari if that helps with anything.

@nbarkhina
Copy link
Owner

Were you able to fix this? I didn't test on 17.4 yet

@BeezBumba BeezBumba reopened this Mar 9, 2024
@BeezBumba
Copy link
Author

No, but it might need tweaking on the webkit feature flags for safari I believe. I’m not sure but it might be a way.

@nbarkhina
Copy link
Owner

Yeah I just tried it this morning on 17.4 on my iPhone 13 mini and can confirm it is really laggy now. Seems like Apple changed something in Safari. I will also play around with the feature flags and see if there is any workaround for this.

@BeezBumba
Copy link
Author

BeezBumba commented Mar 9, 2024

I know they added WebGPU, WebRTC stuff, and 2 or more WebGL settings. It was not talked about in the update and it’s probably something directly on the webkit website. I might be wrong and it might be something else though.

@BeezBumba
Copy link
Author

Did you find anything that may help yet?

@nbarkhina
Copy link
Owner

Nope nothing yet

@BeezBumba
Copy link
Author

I have sent a website issue note to apple because now I'm not really sure what could be the issue. I am suspecting its memory only because when I was editing a Google Slides presentation, whenever I would copy and paste, it can take a while for it to paste.

@nbarkhina
Copy link
Owner

Great - let me know if they come back with anything. Yeah my guess is there's not much we can do unless Apple fixes the issue.

@BeezBumba
Copy link
Author

BeezBumba commented Mar 17, 2024

I now know that it’s not something with the feature flags. I tried enabling/disabling all of them to see if there is a difference, but there was no difference.

@BeezBumba
Copy link
Author

One more thing. My app store is not working for some reason, so can you try to see if the website works for other browsers?

@nbarkhina
Copy link
Owner

I tried in Chrome but it's the same result. All iOS browsers use the same engine.

@BeezBumba
Copy link
Author

BeezBumba commented Mar 21, 2024

Quick question: Is there any part of your scripts that tries to sync the gameplay with the audio if the audio is acting slow? I saw a part in the script.js script that is highlighted and says that it’s outdated and use a different one.It suggested AudioWorkletNode instead of the deprecated ScriptProcessorNode.

@BeezBumba
Copy link
Author

It also has benefits like working on a separate thread instead of the main thread.

@nbarkhina
Copy link
Owner

nbarkhina commented Mar 21, 2024

it only tries to sync to the audio if you uncheck this box - but that code isn't super reliable. I probably need to remove it anyway in a future update (it should always just use vertical sync for the timing). Yes over time if I can figure out web workers I want to try and offload the audio stuff to a separate thread.

image

@BeezBumba
Copy link
Author

17.4.1 has just been released. Have you tried it yet to see if it fixed the issue?

@BeezBumba
Copy link
Author

BeezBumba commented Mar 22, 2024

Also, I did find something intresting. On this website running Banjo-Kazooie, It ran much smoother than this one. Here is the website: https://selenite.is-a.dev/semag/banjokazooie/index.html. It seemed like the code did not get affected by the new update. Maybe there was something outdated that just made it slower?

@nbarkhina
Copy link
Owner

nbarkhina commented Mar 22, 2024

17.4.1 did not help - for me I've tried other emulators they all run slow for me. Seems to be a wider issue.

@BeezBumba
Copy link
Author

BeezBumba commented Mar 22, 2024

What were the other emulators you’ve tried?

@nbarkhina
Copy link
Owner

the one you linked to. if you wait a minute after the intro screen it starts lagging

@BeezBumba
Copy link
Author

For me, the save select screen in the game runs faster. Did you get there?

@nbarkhina
Copy link
Owner

point being I wouldn't call it "playable". perhaps some screens with less geometry run ok, but get to the outside and its very bad. this really needs to be fixed on Apple's side, I don't think any little optimizations here are sufficient.

@BeezBumba
Copy link
Author

BeezBumba commented Mar 22, 2024

Did you find this blog: https://webkit.org/blog/15063/webkit-features-in-safari-17-4/ ? If it’s a problem that Apple has to fix. It might be helpful to find the issue anyways.

@nbarkhina
Copy link
Owner

nothing in the article really sticks out to me unfortunately

@BeezBumba
Copy link
Author

I just found this website https://demo.emulatorjs.org/ that ran fullspeed for me. It uses Retroarch as the emulator. This might have to do with the Webkit engine, Since that actually runs and renders the web pages. They could of changed something up with the power some libraries use, most likely the deprecated ones.

@nbarkhina
Copy link
Owner

Runs just as slow for me for some reason. I tried Mario 64 and only the save select screen runs fast, everything else slow.

@BeezBumba
Copy link
Author

BeezBumba commented Mar 26, 2024

That’s weird. my Ipad 8th generation is running smoothly on that website I gave you.

@BeezBumba
Copy link
Author

Do you have any ideas still? Apple has not responded back yet and I'm completely oblivious of what could be the issue.

@BeezBumba BeezBumba changed the title Updated Ipad to 17.4 Slower due to Ipad iOS 17.4 Apr 7, 2024
@nbarkhina
Copy link
Owner

Nope - does not seem to be much we can do unless Apple hopefully fixes this some day.

@nbarkhina
Copy link
Owner

@BeezBumba ok I may have a fix, stay tuned...

@nbarkhina
Copy link
Owner

ok I made some updates can you try this version and let me know how it runs for you?

https://neilb.net/n64wasm/vbo_test/

@BeezBumba
Copy link
Author

BeezBumba commented Apr 8, 2024

It works! The only thing you have to do is request the mobile website by clicking the Aa on the left hand side on the address bar. But, thank you so much! What did you change?
IMG_2423

@nbarkhina
Copy link
Owner

Take a look at my last commit - you can see the changes I had to make to fix it.

aca7b98

For iOS devices I switched it to use something called "vertex buffer objects" which seems to resolve the rendering lag introduced in Safari.

@BeezBumba
Copy link
Author

Awesome, I'm putting the changes in the codespace so it can generate the new js and wasm files right now.

@BeezBumba
Copy link
Author

Can I also ask how you though of vertex buffer objects?

@nbarkhina
Copy link
Owner

I did some experimentation and isolated the slowness to the glDrawArrays call in geometry.c - that is where it draws all the triangles for the scene. So I was looking at ways to speed that up or make it more efficient. I remembered seeing the VBO code before but I wasn't sure what it did at the time so I commented it out. So I tried adding it back and to my surprise it worked. My understanding is that vertex buffer objects offer certain performance gains.

@BeezBumba BeezBumba reopened this Nov 9, 2024
@BeezBumba
Copy link
Author

What if i were to change the vertex buffer size. what would that do?

@nbarkhina
Copy link
Owner

Not sure - give it a shot and let me know

@BeezBumba
Copy link
Author

BeezBumba commented Nov 10, 2024

So doubling it to 3000 did not impact the issue a lot so i saw the todo stuff on the top

/* TODO: get rid of glitch_vbo */
/* TODO: try glDrawElements */
/* TODO: investigate triangle degeneration to allow caching GL_TRIANGLE_STRIP */

What were you going to use these for?

@nbarkhina
Copy link
Owner

I can't even remember if those were my todos - it sounds like I may have been experimenting with performance

@BeezBumba
Copy link
Author

yeah those were the original page's todos

@BeezBumba
Copy link
Author

Was it just the glDrawArrays that you found that was slow?

@nbarkhina
Copy link
Owner

I'm not sure what aspect specifically was slow. My iPhone is on 18.1 - I just tried it and it runs fine for me.

@BeezBumba
Copy link
Author

It just that most games run full speed except for these ones that I’ve tried: NFL QB CLUB 2000 & 2001, and some sm64 mods. There might be more, but I’m pretty sure all of them have the same issue. Summing it up some games are still laggy and I’m wondering if there was anything else other than the glDrawArrays.

@BeezBumba
Copy link
Author

After the iOS 18.2 update, I feel like there was a slight improvement to FPS for some games. I would say like a 20% increase.

@BeezBumba
Copy link
Author

But I don’t know if it was that update or the iOS 18 versions before it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants