Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to optimize C code for NGPC?
#1
What are some good general guidelines for optimizing C code for NGPC?

Given that there isn't a big NGPC development scene, that also means there's not a whole lot of documentation/tutorials/guidelines available.

Gameboy, on the other hand, has some, and I found this page that has some advice for optimizing C code for GB:
https://gbdev.io/to_c_or_not_to_c.html#asm-help

Per the Gameboy optimization recommendations:
1. Use global variables instead of local if possible, because GB is slow at using the stack.
2. Inline instead of using functions if best performance is desired.

I have refactored much of my NGPC code to use a lot more global variables and at least avoid nested function calls, but I don't think it is making a perceivable difference.

In fact, I am getting what I see as very good performance, even with likely inefficient C code.

The main issue I am running into is with hblank effects bogging performance down noticeably when used on real hardware.  I can cut those out and get what feels like really good performance.

Do recommendations from GB coding carry over into NGPC and/or are there other recommendations for optimizing C code for NGPC?
Reply


Messages In This Thread
How to optimize C code for NGPC? - by winteriscoming - 02-11-2022, 03:55 AM
RE: How to optimize C code for NGPC? - by sodthor - 02-11-2022, 07:43 PM
RE: How to optimize C code for NGPC? - by sodthor - 02-11-2022, 08:49 PM
RE: How to optimize C code for NGPC? - by sodthor - 02-14-2022, 05:33 AM
RE: How to optimize C code for NGPC? - by sodthor - 02-14-2022, 06:29 PM
RE: How to optimize C code for NGPC? - by sodthor - 02-14-2022, 09:16 PM
RE: How to optimize C code for NGPC? - by sodthor - 02-15-2022, 03:38 AM
RE: How to optimize C code for NGPC? - by sodthor - 02-15-2022, 04:17 AM
RE: How to optimize C code for NGPC? - by sodthor - 02-16-2022, 07:25 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)