Skip to content

Instantly share code, notes, and snippets.

@cfr
Created June 9, 2011 10:01
Show Gist options
  • Save cfr/1016452 to your computer and use it in GitHub Desktop.
Save cfr/1016452 to your computer and use it in GitHub Desktop.
Interpreted & compiled Haskell & C + interpreted Python
=======================================================
$ time sh ./nice-langs.sh >> /dev/null
* real *9.117* s
* user 2.370 s
* sys 0.720 s
Interpreted Scala
=================
$ time scala hello.hs >> /dev/null
* real *18.525* s
* user 1.987 s
* sys 0.280 s
#include <stdio.h>
int main() { printf("hello world\n"); return 1; }
main = putStrLn "hello world"
print "hello world"
println("Hello, world!")
# interpreting haskell
ghc -e "main" hello.hs
# compiling and running haskell
ghc -v0 -O3 --make hello.hs -o hello-hs && ./hello-hs
# interpreting C
tcc -run hello.c
# compiling and running C
gcc -O3 hello.c -o hello-c && ./hello-c
# interpreting python
python2 hello.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment