Showing posts with label optimise. Show all posts
Showing posts with label optimise. Show all posts

Thursday, 27 November 2008

Well that was quick!

I'm a little bit gob-smacked. I executed a preliminary profiler run against Miggy and noticed a lot of time was spent building Strings. I thought that was strange as I wasn't running the built-in debugger and so shouldn't be generating a lot of Strings.

And then the penny dropped. Despite turning off logging (I'm using the java.util.logging package), in each of the MemoryControllers I am building a String to pass to the Logger. What's more I'm doing this *every* time I access memory.

I thought I'd try commenting out the these calls in each of the memory access methods and ran my benchmarks again....

How about now averaging at 64.6Mhz. Even when running the profiler (hprof) it was still pulling 58.5Mhz averages.

Now that's changed my mood somewhat :D

First Speed Test

I was starting to get into writing some display code and the DMA controller when I realised I hadn't actually benchmarked the system as yet. So I thought now would be a good time to get an idea of the raw speed of the CPU and see whether there was any chance of this thing being fast enough.

I did the simple thing and wrapped the execution loop in calls to System.currentTimeMillis() counting the number of emulated CPU cycles performed each second. I'm running it against the Kickstart 1.3 ROM code as I know this just continually loops after executing several thousand instructions so gives it a bit of a chance to stretch it's legs.

To be honest, I was a bit disappointed with the result. I'm collecting the average over ten seconds and the system is running around 10.4Mhz over this period. I don't think this is going to be fast enough given all the custom chip, display and sound emulation that still needs to be added.

Now might be a rather good time to profile what I've got and optimise it before starting on the additional hardware emulation.