fredag, augusti 11, 2006

Speed in JRuby.

I had really wanted my next post here to be a tutorial about how to get Camping working with ActiveRecord-JDBC and JRuby, but I managed to find two quite serious bugs related to blocks while trying things out. One of the bugs is really strange, and manifests in some of the Markaby CSS-Proxy internals. So, Markaby works, if you refrain from add css class names to tags.

Since Monday I've been busy with various things in JRuby. I've looked around for easy performance fixes, which there are loads of. Many of them didn't give much, but a few things actually had a noticeable difference. One of these places was in the loading process, where it's important to do as few searches as possibly, since most of them are really expensive. Actually, in a few situations JRuby actually parsed and ran a file several times. This happened in WEBrick among others.

I've also implemented a Java version of Enumerable, which was very trick to get working at first, since JRuby don't really support calling methods that yield from Java. So, I had to devise a way of doing this. The generic case seems to be to hard to do right now, but the specific case of calling each and collect the results in a List are finally working well.

I devised a test case where all Enumerable-operations are used 2 or 3 times, and ran this test case 1_000.times. The results for trunk JRuby was ~7s, while the Java implementation of Enumerable took that down to ~5s, which is nice.

Anyway. That's mostly all. I'm off on vacation now.

Inga kommentarer: