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

See if Emscripten is generating inefficient code for the main emulator switch statement #17

Open
mihaip opened this issue Mar 31, 2022 · 3 comments

Comments

@mihaip
Copy link
Owner

mihaip commented Mar 31, 2022

At least historically this as an issue: emscripten-core/emscripten#1909 and https://bugs.chromium.org/p/v8/issues/detail?id=2275 and https://artemis.sh/2022/08/07/emulating-calculators-fast-in-js.html

@jllipatz
Copy link

Hello,

I am really enjoying infinite mac, OS9 that give me a way to run some personal software elsewhere than on one of my four power macs. But there is definitely a perfomance issue that ruins the project of demonstrating what was Mac OS 9 and under. If I extrapolate what I can see, infinite mac is about 100 times slower what would have been Mac OS on CPUs of todays.
I know that emulating a RISC processor with a CISC one is exactly being on the wrong side of the river, but perhaps some things can be done to reduce the gap.
I wrote a lot of assembly code and I noticed large switches in the C code of the emulator : something that almost never occurs in my own code because it means a lot of tests every time it is run. At least reordering the tests to make a dichotomic search could improve the things. But with assembly code the solution is elsewhere : in computed branches. Is it possible to explore this feature that seems to be present in gcc?

Best regards

@mihaip
Copy link
Owner Author

mihaip commented Jan 24, 2023

I haven't had a chance to look at the generated code for the CPU emulator (for either Basilisk II or SheepShaver), so I don't know if this is actually an issue.

What program are you trying to run? Is it doing mostly integer operations or floating point?

@jllipatz
Copy link

The program is not the issue it is just a benchmark.
My program is some LISP code : it involves interpretation of code and it does a very simple computation on short (word) integers) : the value for the 23th fibonacci number. It uses the naïve way (double recursion) to involve a lot of stack frame creations and to test the speed of the interpreter rather than to measure the speed of numeric computations.
When I first learned Lisp, 1min was considered as a good time to make that computation with Lisp on professional computers. But it was a long long time ago (the 80's!). Infinite Mac does the computation with my own Lisp in 30 seconds (no additionnal application running on the PC) and with the same conditions the best power Mac I have takes 0.7s although running Classic MacOS under MacOSX and the oldest one 1.8s on a true MacOS 9.2
But what I notice first, using infinite Mac, is the way the Mac refreshes the screen. To get some minimal comfort you absolutely have to hide the Finder and other applications.

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

No branches or pull requests

2 participants