Skip to content

Run multiple bus ticks for better performance#237

Merged
twvd merged 9 commits intotwvd:masterfrom
beholdnec:bus-sync
Mar 1, 2026
Merged

Run multiple bus ticks for better performance#237
twvd merged 9 commits intotwvd:masterfrom
beholdnec:bus-sync

Conversation

@beholdnec
Copy link
Copy Markdown
Contributor

This PR makes the emulator step through multiple bus ticks at a time instead of simulating each tick individually. This gives ~50% performance improvement when running a Mac II at Uncapped speed (about 3.0x instead of 2.0x).

The compact bus still steps one at a time to avoid missed vblanks and hblanks. I haven't found any such issues for Mac II, but please test thoroughly before merging.

@beholdnec beholdnec force-pushed the bus-sync branch 2 times, most recently from 8311bb1 to 358954b Compare February 10, 2026 06:40
@beholdnec
Copy link
Copy Markdown
Contributor Author

I'm not sure how to fix

error: could not find native static library SDL2main, perhaps an -L flag is missing?

@twvd
Copy link
Copy Markdown
Owner

twvd commented Feb 11, 2026

I'm not sure how to fix

error: could not find native static library SDL2main, perhaps an -L flag is missing?

Building in a MinGW environment on Windows, which I do in GitHub Actions, still requires pkgconfig. I would suggest you retain the original pkgconfig flag behind a feature flag (sdl2_pkgconfig) and set that in the GHA workflow here:

run: cargo build --verbose --release --all -F sdl2-static

You can have a look at the sdl2_bundled flag as an example.

@beholdnec
Copy link
Copy Markdown
Contributor Author

I attempted to solve this problem with:

[target.'cfg(unix)'.dependencies]
sdl2 = { version = "0.37.0", features = ["use-pkgconfig"] }

[target.'cfg(not(unix))'.dependencies]
sdl2 = { version = "0.37.0" }

Is cygwin not enabling cfg(unix) ?

@twvd
Copy link
Copy Markdown
Owner

twvd commented Feb 12, 2026

I attempted to solve this problem with:

[target.'cfg(unix)'.dependencies]
sdl2 = { version = "0.37.0", features = ["use-pkgconfig"] }

[target.'cfg(not(unix))'.dependencies]
sdl2 = { version = "0.37.0" }

Is cygwin not enabling cfg(unix) ?

It's not cygwin, it's MSYS2 and MinGW which provide a Windows-native build environment, not emulated Unix.

@beholdnec
Copy link
Copy Markdown
Contributor Author

beholdnec commented Feb 12, 2026

I hope I implemented sdl2-pkgconfig correctly, I'm not able to test on all platforms here

@twvd
Copy link
Copy Markdown
Owner

twvd commented Feb 15, 2026

I tested your PR but there's some issues; if I emulate a Mac II and pause, then reset the machine and run it again, the emulator core is frozen and will not respond to any more commands.

@beholdnec
Copy link
Copy Markdown
Contributor Author

I tested your PR but there's some issues; if I emulate a Mac II and pause, then reset the machine and run it again, the emulator core is frozen and will not respond to any more commands.

Checked in a fix!

@twvd twvd merged commit b17cae5 into twvd:master Mar 1, 2026
8 checks passed
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

Successfully merging this pull request may close these issues.

2 participants