#19460 - isildur - Tue Apr 20, 2004 2:35 pm
I have started to implement routines in arm and I noticed that these routines seem to run slower when I put them in iwram. Isn't it supposed to be faster? I have not tested on hardware, I tested with VisualBoyAdvance and Cowbite. Should I be supposed to see improved performance when putting code in iwram even with an emulator or is this performance gain only noticable on real hardware? I am not using thumb code, it is arm code.
#19462 - poslundc - Tue Apr 20, 2004 2:58 pm
Well, much of the speed gain will be visible on hardware since VBA doesn't emulate waitstates properly.
Still, the same code running in IWRAM should not run slower than from other sources. If the code you've written is buggy... well, that could account for slowdown. (Especially in ISRs.)
Dan.
#19464 - isildur - Tue Apr 20, 2004 3:54 pm
I don't know if the code is buggy, it looks ok. Also I am not using ISRs. Could it be because it uses a couple of external global vars that are not located in iwram?
#19471 - torne - Tue Apr 20, 2004 5:46 pm
This might slow it down if it uses them a lot; they may be too far away to generate PC-relative offsets and thus have to have their addresses loaded through a constant pool. That's the only reason I can think of why it would be slower.
#19472 - isildur - Tue Apr 20, 2004 6:16 pm
Ok, in fact, the code runs faster in iwram. I fixed my way of calculating the time my routines take. But it looks like vba runs at 92% speed instead of the 100% it gets when I don't use iwram. Its like the whole game runs jerkish in vba even though the iwram routines run faster...
#19480 - sajiimori - Tue Apr 20, 2004 8:07 pm
The speed at which the emulator runs simply does not reflect the speed at which the code will run on hardware. If you had the VBA source, you could dig thru it and try to discover why it runs slower, but why would you?
#19490 - isildur - Tue Apr 20, 2004 8:42 pm
I was just trying to figure out what was going on. I wanted to make sure I wasn't doing something wrong. It was just strange that by using iwram, the emulator would run slower. And since I don't have a flash cart yet, I can't test it on hardware.
#19492 - tepples - Tue Apr 20, 2004 9:57 pm
A GBA emulator on a sub-GHz machine slows down somewhat when running ARM code from IWRAM for two reasons: more instructions are executed in a given number of cycles, and each instruction takes more time to decode. Most of the time, when you're running code in ROM or EWRAM, it's Thumb code. It's a lot more CPU-intensive to decode ARM instructions than to decode Thumb instructions. ROM can provide only about 4 million ARM instructions per second (wait, 16-bit fetch, wait, 16-bit fetch = four cycles); IWRAM can provide 16 million.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#19504 - poslundc - Tue Apr 20, 2004 11:52 pm
Keep in mind that the speed of your code has nothing to do with the complexity of what the emulator has to do in order to emulate your code.
Dan.
#19507 - isildur - Wed Apr 21, 2004 12:35 am
Yeah, I guess it makes sense. I know its not because of my code because I tested with other code using iwram and I get the same results. And I'm on a p3 so it makes sense that the emulator needs more cpu power to emulate ARM code. Thanks for your responses.
#20503 - sasq - Wed May 12, 2004 8:35 am
The only emulator I've found to be somewhat correct with these things is Nocash - I don't know if the demo-version (Multiboot only, sound or color) is still downloadable but I'd recommend it for speed tests.
#20534 - isildur - Wed May 12, 2004 4:00 pm
I got myself a a flash cart now so I can test speed issues directly on hardware. Thanks anyways.