Sorry to keep bringing this up, but would running the java version on unix be faster? I think that in order to evolve interesting behaviors, we may need to run an order of magnitude more cycles than even the longest-running DB sims we've made. So speed is my main concern.
Not an order of magnitude faster. I did a test recently and my math-driven CPU bound algorithm runs 5 times slower under Mono than under .NET. So at the worst case that would be the difference. I think (hope) there's some performance work on Mono that will make that number far lower when an actual program is released.
Under windows, the difference in speed between C# and C/C++ code is usually about 10% in C++'s favor. Unless SSE instructions are used, and then it's more like 70-80% in C++'s favor, just because C++ has intrinsics for SSE and C# does not.
On point, Java probably would be faster on linux, just because there's a better open source JIT for Java bytecode over CIL (the .NET's version of bytecode). But language choice isn't going to make or break any performance comparisons. At best you're talking about a range of a constant order of magnitude faster. Considering hardware is still doubling horsepower every 18 months, I'm not worrying much about constant factors.
The core engine is going to achieve significant speedups algorithmically.
Also, isn't there such a thing as an optimizer for C# code? Could we use that?
Yes, it's called the JIT compiler. The one for Microsoft's implementation (.NET) is quite good. Mono's is slightly less so at the moment, but I think that gap should close soon.
And finally, can we convert it into a really low level language, like C, easily?
Not easily, no. If nothing else I make heavy use of features that just aren't available in C, like the extensive real time reflection system.
More to the point on speed concerns: this really is a case where big O trumps any constant order overhead you can throw at the problem. There will be a few core routines that will bottleneck the entire program. When we get that far, I can play with swapping out our matrix routines for LAPACK and BLAS, for instance. But you're still talking constant order speed ups. I'll be spending far more time investing in things like a sparse matrix decomposer, which would change a part of the program from O(n^3) to O(n^2) or maybe even O(n) (I'm unclear about the order of complexity of sparse routines).
I have a list I can present of math intensive areas of the program where someone smart can spend some time implementing better algorithms, if anyone's interested. Effort here can give something like a 1000x speedup over a measly 5x speedup, with that number getting even bigger as you add more bots.
I mean, an algorithm optimizer?
That's what programmers are for, and why we get paid the big bucks.
I get the concern for speed. But besides that I think we need to look at the parameters used in a evolution sim will get a load of time win. Some setups will never succeed.
I believe you're talking about DB3, whole thing is being written in C#. First finish it, then look how to improve it. If it was done purely for speed, it was written in C. But would take more time to finish as well.
I'm far from a expert on coding, but what could the percentage difference be between optimal C# and optimal C++. Or java and C++. Is the difference between object-orientated and "normal" that big.
I doubt the performance difference between java and C# would be big. I think there is more to win is optimizing the C# code instead of translating it.
I don't have numbers for Java vs. C#, but generally speaking, each level of abstraction adds a 10% slowdown over equivelant expertly written code. So C vs. Assembly, you're talking something like 10%. C++ vs. C, something like 10%. JIT vs. C/C++, something like 10%. Those are rough numbers, of course. Actual numbers vary quite largely.
Why do we accept this performance/memory loss? The increased productivity and maintainability at higher levels tends to offset the losses. Writing a large program is assembly is almost impossible. Writing one in C is possible, but it can easily become a maintenance nightmare. C++ helps by introducing object oriented programming as a first class language feature. C# helps by giving access to the .NET framework as a first class language feature, and allowing for the JIT to handle per-client optimizations.