mirror of https://github.com/pret/pokeemerald.git
Updated Improving the WaitForVBlank function (markdown)
parent
145191a4af
commit
8e6a1fab2a
|
@ -19,9 +19,9 @@ static void WaitForVBlank(void)
|
||||||
+ VBlankIntrWait();
|
+ VBlankIntrWait();
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
One thing to note is that on agbcc's `-O2`, we still pay the price of a function call, as `VBlankIntrWait` fails to be inlined. In general, agbcc is very conservative on optimizations. Most other decent optimizing compilers (or if you `make modern`) will inline the function.
|
||||||
|
|
||||||
Alternatively, we can do what the `VBlankIntrWait` function does in a more direct manner, which is unnoticeably faster.
|
A solution is to inline it ourselves, for a negligible performance benefit:
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
static void WaitForVBlank(void)
|
static void WaitForVBlank(void)
|
||||||
{
|
{
|
||||||
|
@ -32,4 +32,4 @@ static void WaitForVBlank(void)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Save, build a ROM, and so the game will utilize the full power of the GBA's CPU in order to draw things on screen. The easiest way to notice this is while running the game on a GBA emulator with a FastForward feature implemented, where implementing this fix will give you a 100-150% increase in speed.
|
Save, build a ROM, and so the game will no longer waste CPU power while it is waiting for the next VBlank. The easiest way to notice this is while running the game on a GBA emulator with a FastForward feature implemented, where implementing this fix will give you a 100-150% increase in speed.
|
Loading…
Reference in New Issue