-
Notifications
You must be signed in to change notification settings - Fork 60
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
Cumulative optimizations #336
Conversation
ps2.c
Outdated
void | ||
mouse_button_down(int num) | ||
{ | ||
buttons |= 1 << num; | ||
mouse_send_state(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request #321 removed those function calls, for a good reason. Why did you add them back?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's essentially a merge error since I completely rewrote ps2.c/ps2.h on my fork. Will fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be cleaned up now. Sorry about that. And the emulator should be even faster still as a result. 😃
Changes resolved with latest submits to master. |
With the latest i2c stuff checked in, I'm seeing 76% -> barely eeking out 100% on an RPi4. I'll be looking at the i2c stuff eventually, I'm sure, to see if I can't give it the same treatment as the ps2 emulation. But not for this PR, and probably not for at least a week. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, just some nits
void mouse_move(int x, int y); | ||
void mouse_send_state(); | ||
// fake mouse | ||
void mouse_button_down(int num); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please no indentation to line up function names
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will try to keep this in mind in the future. I blame clang-format.
@@ -18,12 +19,19 @@ | |||
// VIA#1 | |||
// | |||
// PA0: PS2KDAT PS/2 DATA keyboard | |||
// PB0-2 ROM bank |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where do these outdated lines come from? :)
@@ -37,59 +45,55 @@ | |||
|
|||
static uint8_t via1registers[16]; | |||
|
|||
void | |||
via1_init() | |||
void via1_init() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please keep the type in a separate line, like in all other code
{ | ||
uint8_t out_mode = reg_composer[0] & 3; | ||
|
||
bool new_frame = false; | ||
float advance = ((out_mode & 2) ? NTSC_PIXEL_FREQ : VGA_PIXEL_FREQ) / mhz; | ||
float advance = ((out_mode & 2) ? NTSC_PIXEL_FREQ : VGA_PIXEL_FREQ) * steps / mhz; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no identation of this kind, please. it will keep diffs minimal.
Never mind, I merged it, and I'll change the nits myself :) |
* Removing branches and needless loops from ps2, joystick, video_step, vera_spi_step. * byte -> value: Variable name change: Windows SDK conflict. * Documentation updates
amended by changes the commit, new commit: abfe032 |
* Removing branches and needless loops from ps2, joystick, video_step, vera_spi_step. * byte -> value: Variable name change: Windows SDK conflict. * Documentation updates
Awesome, thanks! |
A collection of optimizations ported over from my C++-based fork of the X16 emulator:
Altogether, warp speed on a Raspberri Pi4 has gone from 101% to 157%.
Non-warp speed on a Raspberri Pi4 has gone from 80% to a rock-steady 100%.
I'm certain my previous experiments with RPi4 pegged performance in the mid-30% range, and I cannot explain the discrepancy in baseline performance between then and now. Go team? Compiler optimizations added at some point? RPi4 update made more resources available? Whatever the case, this still represents a significant jump in performance by removing the most significant bottlenecks outside of the hot paths of the VERA and base CPU emulation, and all platforms will benefit from this.