May 31st, 2010 by Moggen

A kind of slow week. Much to do at work and I have been a bit tired in the evenings when I usually work on Emumiga.
Got some gadgets visible though:

The buttons look a bit funny. I’m not sure why. Maybe Clock will run some other syscall to adjust them later on.

May 24th, 2010 by Moggen

The focus this week was on performance.

I finished my skip-list structure and integrated it into the mapping handling. I discovered, during development, that keeping entries sorted by starting address by itself gave the biggest speedup. The old version scanned all entries every time a lookup was made, but with sorted entries you can stop looking when an entry is past the lookup address.

Some extra performance was gained by the skip mechanism but not much in my measurements. But I think this gain would be bigger in a large application with lots of memory blocks, or if several applications are run simultaneously.

I have also added a simple caching mechanism. It uses a global serial number that gets incremented every time a mapping is added or removed. A special cache handle keeps track of the entry last looked up. If a new lookup is made and it is within the same mapping and the serial number is not changed, we have a hit in the cache and we do not have to traverse the skip list at all.

I added an instruction cache handle and a data cache handle into the CPU structure in the processor emulation. Instruction fetches use the instruction handle and data accesses use the data handle. These caches madeĀ  another 10% gain in performance.

I used a simple “sieve” program for some measurements.
Here are some numbers:

Scenario sieve 3000 sieve 10 000 sieve 20 000 000
No optimizations 36 s not measured not measured
Skip-list ~4 s 31 s not measured
Skip-list + cache ~4 s 27 s not measured
Native AROS sieve ~0 s <1 s 23 s

As you can see, my optimizations give quite a performance boost, almost a 10 time speedup! But yeah, I’m still behind the native application by a factor of two thousand. But this is only the beginning!

I will leave the performance work for now and work on the last remaining things needed to run “Clock” fully.

May 17th, 2010 by Moggen

I’m preparing for the release of the code so I’ve applied the dual license scheme onto all files in the project except for a few put into public domain. I did some cleanup at the same time. There were a few testing files and old defunct stuff not used, now removed from the source tree.

The BTree coding got quite complicated so I threw that out and switched over to a skip list structure instead. The performance gain should be about the same but the implementation is much simpler, and I like simple.

May 10th, 2010 by Moggen

The work during this week has been focused on internals.

I’ve tracked down 2 nasty memory bugs that has been showing up in the Mungwall console log for a while. But as long as Mungwall was present it continued to work fine so I haven’t paid much attention to it until now.
But when I ran Emumiga on an Icaros system without Mungwall it crashed hard so I dug into it and found the bugs at last. It was one case of bad string length calculation and the other was caused by CreateIORequest().
I had just passed the request size as it were to the real syscall. This is not working. The size of the AROS structure that should correspond to the one created by the Amiga program may differ. Maybe some fields are of other types, maybe there is 64 bit and the pointer sizes are doubled or maybe AROS has some extension.
Easy fixed? Well it seems so at a first glance; just adjust the size to the AROS size. But the problem is that the type of the request is not known until later, typically when OpenDevice() is called.
I used a simple workaround, just add some extra margin to the size and we should be fine. It will do for now.

I have continued to work on some kind of BTree approach for the mapping entries to speed up the lookups. BTrees are a bit tricky to implement, but I’m working on it.

May 3rd, 2010 by Moggen

A kind of slow week regarding coding. I held a presentation about unit testing in a small development community that I’m a member of. Jakob was there too. But no, I’m not using unit testing in emumiga. Too bad actually.

Nice spring weater called for some work in the garden, and I and my wife went away on a weekend trip.

So all I managed to produce this week was some new syscalls and structures for graphics.library and I began working on Gadgets.

“Clock” is getting more and more complete. I can switch between analog and digital, show the date and change the digital date format right now. The gadgets will be used for setting the alarm.

Still to do on Clock are:

  • Alarm
  • Save settings
  • Command line parameters
  • Proper exiting