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

Performance improvements found while porting to Teensy 4.1 #223

Open
dashiad opened this issue Oct 17, 2021 · 1 comment
Open

Performance improvements found while porting to Teensy 4.1 #223

dashiad opened this issue Oct 17, 2021 · 1 comment

Comments

@dashiad
Copy link

dashiad commented Oct 17, 2021

Hello,
First of all, thank you for this piece of code.I've learnt a lot about the 1541 reading it...Really, thank you.
I've made a "sort of a port" of the pi1541 to the Teensy 4.1 , and had problems maintaining the required timings as soon as the motor drive was started (ie, the Update method of the Drive class enters the 16 cycle loop).
In the Teensy case, it was resolved changing the type of cyclesPerBit and cyclesForBit to integers, as using floats in that loop was really hurting performance.
Same goes with randomFluxReversalTime. Also, even though i've not implemented it, as that variable is random, i guess it'd be safe to test it outside the for loop (ie, setting randomFluxReversalTime to 16*-0.0625,as if the reversal time was always coupled to 1 CPU cycle boundaries). This would save a few cycles more.
I dont know if floats are also slow in the Pi, or if saving cycles is still needed, but, anyway...

@hugo-lyppens
Copy link

I tried this on my Pi1541 build (very easy to build from WSL2!) in hopes of getting Winter Games II working again on 1.24 but it did not help. I have a Raspi 3B overclocked to 1300MHz. But I agree that these variables should be ints. Even if they are ints representing fractions. Perhaps lowest byte could be the fractional part (/256).

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