Re: [Vala] Port Tomboy?




On 28/06/2009, at 1:57 AM, Jiří Zárevúcky wrote:
Wrapped native code is generally slower and more difficult to work
with then a pure CIL implementation. The library in question would be
more likely to exist in two separately maintained versions.


There are several good reasons to convert to native code, but I think "performance" is probably one of the worst. Modern VMs produce reasonably efficient code for the hotspots that they consider to be worth optimising, and there are actually quite a few optimisations they can do at runtime that statically compiled native code can't[0].

99% of your code isn't going to be the performance sensitiv, and as Jiří mentioned crossing the VM<->Native boundary can potentially be more expensive than having it all in the VM. it's not always, and there are times when native code will still be faster, but it's not in every case.


I don't know a lot about .Net and Mono, as I come from a Java/JVM background, and there are cases where performance sensitive code can actually be faster running in a VM than statically compiled.

Say for example you have a library which needs to be thread safe, and so has locking code in various places. With native code, you're going to be paying the price of the locking even if you application (or the part of it that uses the library) is single threaded. Recent JVMs are smart enough to realise this and won't even bother to allocate a lock until a second thread touches an object created by a different one.


I'm not saying you shouldn't port code from one language to another, but make sure you have your reasons right :)


[0] well, native code can do them in the possible on a Turing machine sense, but not practically.

--
James


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]