On 10/01/2013, at 2:37 PM, resolute wrote: > HelloWorld test with python > root@resolute-ubuntu:/usr/local/src# time flx hello.flx > Hello World > > real 0m1.111s > user 0m1.028s > sys 0m0.052s > root@resolute-ubuntu:/usr/local/src# time python he.py > helloWOrld > > real 0m0.016s > user 0m0.004s > sys 0m0.008s > > Is that something wrong with my operate? >
Run the Felix again. The first time it has to compile the code from Felix to C++ and C++ to binary. The second time it just checks time stamps and runs the binary. Also hello world is not a realistic test, Python may run this faster even after compilation to binary because the execution time of the actual code, for Python, or Felix, is only a tiny fraction of the run time: actually loading the code and starting up may take longer. ~/felix>flx speed/ack/felix/test.flx Ack(3,13): 65533 4.91068 is a more realistic test. That's using clang -O1. HAHA OMG: ~/felix>flx -O2 speed/ack/felix/test.flx Ack(3,13): 65533 7.56319 Clang is generating SLOWER code with -O2 than -O1! here's C (unoptimised): ~/felix>gcc speed/ack/c/ack.c -o a.out ~/felix>time ./a.out Ack(3,13): 65533 25.252633 real 0m25.295s user 0m25.203s sys 0m0.053s gcc with -O2 does better: ~/felix>gcc speed/ack/c/ack.c -O2 -o a.out ~/felix>time ./a.out Ack(3,13): 65533 8.356915 real 0m8.372s user 0m8.345s sys 0m0.015s And clang 3,.3 with -O2; ~/felix>clang speed/ack/c/ack.c -O2 -o a.out ~/felix>time ./a.out Ack(3,13): 65533 7.522444 real 0m7.531s user 0m7.512s sys 0m0.014s So Felix TRASHES gcc and clang. Here's the Python: def ack(x,y): if x == 0: return y + 1 elif y == 0: return ack(x - 1, 1) else: return ack(x - 1, ack(x, y - 1)) n = 13 v = ack(3,n) print("Ack(3,%d): %d" % (n, v)) And here's the output: RuntimeError: maximum recursion depth exceeded in comparison Oops. Felix is infinitely faster. Here with n=6, the maximum I can do on my box: ~/felix>time python3 ack.py Ack(3,6): 509 real 0m0.137s user 0m0.113s sys 0m0.020s And Felix: ~/felix>time flx ack Ack(3,6): 509 0.000298023 real 0m6.782s user 0m6.521s sys 0m0.236s ~/felix>time flx ack Ack(3,6): 509 0.000296116 real 0m0.038s user 0m0.015s sys 0m0.017s The first time is slower because it takes 6 seconds to compile. This isn't a realistic test. Python simply cannot do this. The performance compared to C here is no accident, but I have seen this vary a huge amount. -- john skaller skal...@users.sourceforge.net http://felix-lang.org ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnmore_122712 _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language