3 ms·
I'm in scientific computing so the floating-point performance is by far my biggest concern. In the tests I just ran, Nimrod and C are virtually identical in tim
by comicjk 13y ago
I'm in scientific computing so the floating-point performance is by far my biggest concern. In the tests I just ran, Nimrod and C are virtually identical in time (probably creating near-identical machine code).
test.nim:
var sum = 1.0
while sum<1.0e10:
sum = sum*1.00000001
echo($sum)
test.c:
#include <stdio.h>
int main() {
double sum = 1.0;
while(sum < 1e10) {
sum *= 1.00000001;
}
printf("%f\n", sum);
return 0;
}
C time / Nimrod time, average of 10 runs: 1.00
- rdtsc 13y agoPerhaps unrelated. What are you thoughts so far on Julia? http://julialang.org/ http://julialang.org/
- comicjk 13y agoI've checked it out on your recommendation. I like the syntax even better than Nimrod's, it has better support for scientific work, and the floating-point performance is virtually identical. The only problem is that global variables are apparently not allowed to be typed as plain primitives, so this program: s = 1.0 while s<1.0e10 s = s*1.00000001 end println(s) Has mysteriously terrible performance. You have to use: function test() s = 1.0 while s<1.0e10 s = s*1.00000001 end println(s) end test() to see what Julia can really do.