mihaip / infinite-mac

A classic Mac loaded with everything you'd want
https://infinitemac.org
Apache License 2.0
1.19k stars 73 forks source link

Slow dissolve transition (eg. in HyperCard) #42

Closed gingerbeardman closed 1 year ago

gingerbeardman commented 2 years ago

This isn't unique to your project, I've seen it in BasiliskII proper. Apparently the CPU hits 100% during the transition for some reason.

So I'm interested in your thoughts on it?

The attached file will need to be expanded using Stuffit Expander, and opened using HyperCard. Compare the speed of the transition with Mini vMac.

Thoru Yamamoto's "A Little Tree" HyperCard stack A Little Tree.sit.zip

gingerbeardman commented 1 year ago

Turns out this issue was because BasiliskII lacked a high resolution timer, which was present only in SheepShaver.

Fixed a few hours ago in the latest BasiliskII source https://github.com/kanjitalk755/macemu/issues/107#issuecomment-1531143919

that-ben commented 1 year ago

@mihaip We need this implemented in InfiniteMac! :)

mihaip commented 1 year ago

https://github.com/kanjitalk755/macemu/commit/1199f8115e3e8569a7551126f51182183cea5a75 was the commit that fixed this on in the kanjitalk755 fork. I'll look into updating mine with recent changes, but it may require additional work (the timer uses threading, which is not available in the Emscripten setup that I have).

mihaip commented 1 year ago

Not actually fixed, even with the picked up change.

gingerbeardman commented 1 year ago

What are you seeing?

Yesterday, before posting, I built the BasiliskII source myself on macOS to confirm it was fixed.

So I guess the additional work you mention is indeed required for your port?

My results:

https://user-images.githubusercontent.com/49612/236471107-8bd91533-b588-41eb-844f-573c1c6a27af.mov

mihaip commented 1 year ago

@gingerbeardman yes, additional work is required in the WebAssembly version. You can tell because the WebAssembly version of SheepShaver also has slow dissolves, even though the native version did not even before this fix.

that-ben commented 1 year ago

Aren't workers basically threads? I'm sorry for the n00bness here, but I would have thought the modern browsers automatically made threads out of JS workers.

mihaip commented 1 year ago

@gingerbeardman This should be fixed for real now (at least the dissolves in that HyperCard stack are fast now).

@that-ben: while workers are analogous to threads, they do require some work by the Emscripten compiler to be made to work (see https://emscripten.org/docs/porting/pthreads.html). They also assume that SharedArrayBuffer is available, which is not the case for 5-7% of users of Infinite Mac (mostly older versions of Safari, before 15.2). Thus far I have not relied on threads.

gingerbeardman commented 1 year ago

Thanks! Neat solution from you. Nice work!