deltabeard / Peanut-GB

A Game Boy (DMG) emulator single header library written in C99. Performance is prioritised over accuracy.
https://projects.deltabeard.com/peanutgb/
276 stars 35 forks source link

core: return pointer on gb_read #64

Open deltabeard opened 1 year ago

deltabeard commented 1 year ago

On consecutive reads, it may be faster to obtain a pointer to ROM data on a single call to gb_read, rather than calling gb_read for each byte read.

The same optimisation could also be performed for gb_write.

deltabeard commented 1 year ago

Work being done on https://github.com/deltabeard/Peanut-GB/tree/pointer branch.

deltabeard commented 1 year ago

Reading ROM data is probably inlined by the compiler. Profiling needs to be performed to see if using a pointer instead of a function actually results in any speed improvement.