.net vs Ruby - Performance
|
|
Hi Just to start let me say that I’m coming at this from a Pro Ruby angle, and actually want ruby to do really well. If its anywhere near 50% as fast as .net I’d be over the moon. Here’s my tests so far, one app wrote both in .net(124 requests a sec) and ror (26 requests a sec). So fairenough its slower, thn I expected but then I found something very interesting. A basic hello world page in ruby when hammered with Web Application Test suite(MS) shows as running at 50req/sec, however the ruby logs show it at 1000 req/sec. So I’m guessing I’ve not changed a setting somewhere so that this runs at the right speed. Does anyone have any idea’s what I may of missed, it is running on production inside mongrel. Cheers Andy |
|
|
Hi Andy, Are you using .net 2.0 or 1.1? I suspect a difference in the caching mechanism. Although you’re in production mode, the page output won’t be cached by default. I can’t recall how .net handles its cache, but that may be part of the performance difference. Try turning on page or action caching in your Rails app; I would be curious to know if there’s any difference. Once you’re beyond the http stack and caching differences, Ruby will certainly be slower when it needs to be interpreted as compared to JITted C# code. Once JITted the first time, .net caches the optimized code for re-use. There is no such equivalent to Ruby since it is fully reinterpreted each time (currently in 1.8.x, anyway). I’d be interested in any further results if you’re wiling to publish more results. |
|
|
Hi Jeff, Sorry I didnt reply sooner but I thought the thread had died. I’m sure that adding caching will add a massive speed boost, but I wanted to compare the two apple’s to apple’s or at least as close as possible. Plus I’m fairly certain .net does no actual html caching as part of process, it must just be generally faster. Besides if .net is that fast uncached, putting caching on that side to compare, would be like adding rocket fuel. Just to make sure I’m not misunderstood, I’m sure ruby will scale enough for my needs and most other peoples. I was just interested in the results. On a seperate note though, I did a line count on both solutions, the .net solution was 4000+ lines of code(not including white space or comments), and the ruby one was just over 1500(using rake stats, dont know if that includes white space and comments). So thats a another rather interesting metric to look at. Andy |
|
|
Oh and the .net line count didnt include the xml config files for nhibernate. |
|
|
Oh Just did a little more investigation on the lines of count front, and I realised that the only reason the rails version is smaller is because rake stats doesn’t include the View, where as the .net one does. After excluding the website, code i was using MVP anyway the code size is practically the same. So then I dug a little deaper and the real reason for the huge code base was infact because I was using the CSS Toolkit. All interesting facts, ruby is definetley more fun either way you look at it, especially since it doesnt use that windows programming abstraction layer – yuk! Andy |