>>3
were you expecting interpreted languages to beat C native code?
Name:
Anonymous2012-01-07 19:40
>>5
No, but I wasn't expecting a difference like that >>4
That was due yo a makefile I had set up for some opengl shit
Name:
Anonymous2012-01-07 19:49
>>2'
>implying piping isn't 2 file descriptors
>implying piping is slower than file I/O
time echo "100000000.times do b = 3.14159265 / 1.161803399 end"
$ time echo "for i in range(100000000): b = 3.14159265 / 1.161803399" | python # crash incoming
Killed
real 0m37.495s
user 0m1.412s
sys 0m4.440s
Name:
Anonymous2012-01-07 20:11
[ Sat Jan 07 08:02:57 ]
[ @ ~/fhost/prog/java ] $ cat p.java
public class p
{
public static void main(String args[])
{
double a;
int i;
for(i=0;i<100000000;++i){
a = 3.14159265 / 1.161803399;
}
}
}
[ Sat Jan 07 08:03:02 ]
[ @ ~/fhost/prog/java ] $ javac p.java
[ Sat Jan 07 08:03:09 ]
[ @ ~/fhost/prog/java ] $ time java p
real 0m0.371s
user 0m0.184s
sys 0m0.176s
[ Sat Jan 07 08:03:33 ]
[ @ ~/fhost/prog/java ] $ time echo "for i in range(100000000): b = 3.14159265 / 1.161803399" | python
real 0m50.468s
user 0m43.071s
sys 0m7.392s
[ Sat Jan 07 08:10:14 ]
[ @ ~/fhost/prog/java ] $ cat p.c
int main() {
double a;
int x;
for(x=0;x<100000000;x++)
a = 3.14159265 / 1.161803399;
return 0;
}
[ Sat Jan 07 08:10:18 ]
[ @ ~/fhost/prog/java ] $ gcc -S p.c
[ Sat Jan 07 08:10:21 ]
[ @ ~/fhost/prog/java ] $ gcc p.s
[ Sat Jan 07 08:10:24 ]
[ @ ~/fhost/prog/java ] $ time ./a.out
user@host ~/prog/go % echo -e 'package main\nfunc main(){var x int\nfor x = 0; x < 1e8; x++ {\n_ = 3.14159265 / 1.161803399\n}\n}'>benchmark.go&&time 8g benchmark.go&&time 8l -o benchmark benchmark.8&&time ./benchmark
8g benchmark.go 0.00s user 0.00s system 85% cpu 0.008 total
8l -o benchmark benchmark.8 0.08s user 0.01s system 99% cpu 0.092 total
./benchmark 0.73s user 0.00s system 99% cpu 0.732 total
>>20
user@host ~/prog/c % time echo 'int main(){double a;int x;for (x = 0; x < 100000000; x++)a = 3.14159265 / 1.161803399;return 0;}'|gcc -xc -O0 -o benchmark - && time ./benchmark
echo 0.00s user 0.00s system 48% cpu 0.002 total
gcc -xc -O0 -o benchmark - 0.08s user 0.04s system 84% cpu 0.136 total
./benchmark 0.67s user 0.00s system 99% cpu 0.672 total
Name:
Anonymous2012-01-07 21:31
% python -V
Python 2.7.2
% time echo "for i in range(100000000): b = 3.14159265 / 1.161803399" | python
python 15.62s user 1.24s system 98% cpu 17.030 total
time echo "for i in xrange(100000000): b = 3.14159265 / 1.161803399" | python
python 12.66s user 0.01s system 99% cpu 12.675 total
% ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
% time echo "100000000.times do b = 3.14159265 / 1.161803399 end" | ruby
ruby 25.98s user 4.03s system 99% cpu 30.013 total
% su -c 'eselect ruby set ruby19'
Password: s33crit
% ruby -v
ruby 1.9.3dev (2011-09-23 revision 33323) [x86_64-linux]
% time echo "100000000.times do b = 3.14159265 / 1.161803399 end" | ruby
ruby 12.50s user 0.01s system 94% cpu 13.236 total
% python3 -V
Python 3.1.4
% time echo "for i in range(100000000): b = 3.14159265 / 1.161803399" | python3
python3 8.66s user 0.01s system 92% cpu 9.390 total
% php -d memory_limit=6G -r 'foreach (range(0, 100000000) as $i) $b = 3.14159265 / 1.161803399;'
PHP Fatal error: Allowed memory size of 6442450944 bytes exhausted (tried to allocate 71 bytes) in Command line code on line 1
% time php -r 'for ($i = 0; $i < 100000000; ++$i) $b = 3.14159265 / 1.161803399;'
php 6.21s user 0.01s system 99% cpu 6.220 total
% cat tst.hs
main = mapM_ (const $ 3.14159265 / 1.161803399 `seq` return ()) [1..100000000]
% time ghc -O2 -o tst tst.hs
[1 of 1] Compiling Main ( tst.hs, tst.o )
Linking tst ...
ghc 0.40s user 0.14s system 8% cpu 6.755 total
% time ./tst
./tst 0.20s user 0.00s system 98% cpu 0.202 total
% node -v
v0.6.6
% # how does I make range in JS?
% time echo 'for (var i = 0; i < 100000000; ++i) var b = 3.14159265 / 1.161803399;'| node
node 0.18s user 0.00s system 99% cpu 0.188 total
Name:
222012-01-07 21:40
>>21 for comparison
% time echo 'int main(){double a;int x;for (x = 0; x < 100000000; x++)a = 3.14159265 / 1.161803399;return 0;}'|gcc -xc -O0 -o benchmark - && time ./benchmark
echo 0.00s user 0.00s system 0% cpu 0.001 total
gcc -xc -O0 -o benchmark - 0.01s user 0.01s system 71% cpu 0.028 total
./benchmark 0.22s user 0.00s system 99% cpu 0.221 total
>>31
you know what's even more retarded? Thinking you're gonna get a good result when comparing native vs interpreted.
Now how about you go shit on someone elses thread you faggot
Name:
Anonymous2012-01-08 4:23
The point in benchmarking is I know native is faster than interpreter, but I want to know how much, and I also wanted to compare different interpreted languages. I found the results interesting and therefore posted them. I always thought Ruby was slower than python. SCIENCE
Name:
Anonymous2012-01-08 4:28
>>30
Then if C was merely looping, comparatively, Erlang is fastand I am proud
Name:
Anonymous2012-01-08 8:05
rofl, hahaahahahaha omfg wow gg loloolol wowwww omg lolllllll so fanny lol like 1 minute faster and how long does it take to read in comparison faggot?
>>33
If you really wanted to know how much you shouldn't be doing things like these because they are pointless. Real code does not do things like this at all, and there is a reason gcc's optimizations take away all the code (it's pointless and does nothing). Maybe try making a program that does real work and port it to other languages for comparison, if you really wanted to waste your time but do the ``Right Thing'' instead. IHBT, because I replied.
>>34
I don't think you understand that the gcc optimization is referring to >>9.
public class Benchmark
{
public static void Main(string[] Args)
{
double a;
for (int x = 0; x < 100000000; x++)
a = 3.14159265 / 1.161803399;
}
}
Results: (compiling just with a plain "csc benchmark.cs". And Windows has no "time" command, so I had to use Powershell)
PS C:\Users\me> Measure-Command {start-process benchmark.exe -Wait}
* (defun l100 () (dotimes (i 100000000) (/ 3.14159265 1.161803399)))
L100
* (time (l100))
Evaluation took:
0.160 seconds of real time
0.160010 seconds of total run time (0.144009 user, 0.016001 system)
100.00% CPU
426,443,480 processor cycles
0 bytes consed
>>36
[quote]Real code does not do things like this at all[/quote]
Have you ever used OpenGL? It's all floating point arithmetic, and benchmarking that is a true show of the speed of a language. Maybe OpenGL doesn't divide Pi by Phi millions of times, but it uses trigonometry like a bitch
Name:
Anonymous2012-01-08 15:41
>>60 Benchmarking OpenGL is a true show of the speed of a language
Who am I quoting.
>>60
You're braindamaged if you think that OpenGL does floating point divisions of two constants in a loop and nothing else. You can benchmark an OpenGL program that you port to multiple languages and see if you run into any differences. There already are implementations of things like glxgears in most languages with OpenGL bindings, so it's not like you would have to write any real code.
But if you think timing a million divisions in a loop is the same thing as benchmarking a whole OpenGL program, as if the entire doing graphics thing is non-important to the sight of floating point divisions(of constants), that would explain everything.