Skip to content

Instantly share code, notes, and snippets.

@gchebanov
Created February 24, 2019 18:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gchebanov/dbd42ea390876b6c4128aff2d2a8e85d to your computer and use it in GitHub Desktop.
Save gchebanov/dbd42ea390876b6c4128aff2d2a8e85d to your computer and use it in GitHub Desktop.
benchmark loli-lang list append 10^7 times.
~/repo/loli/build on  master ⌚ 21:00:11
$ g++ -o hw hw.cpp && time ./hw
test cpp: 0.243968 Seconds
./hw 0.21s user 0.07s system 98% cpu 0.291 total
~/repo/loli/build on  master ⌚ 21:00:18
$ time python3 ./hw.py
test Python: 0.7941131591796875 Seconds
python3 ./hw.py 0.82s user 0.05s system 98% cpu 0.889 total
~/repo/loli/build on  master ⌚ 21:00:30
$ time ./loli hw.li
test Loli: 0.891672 Seconds
./loli hw.li 1.45s user 0.11s system 99% cpu 1.578 total
~/repo/loli/build on  master ⌚ 21:00:40
$ cat hw.py
import time
def test(n):
start_time = time.time()
a = []
for i in range(n):
a.append(0)
print('test Python: ', time.time() - start_time, ' Seconds')
test(10**7)
~/repo/loli/build on  master ⌚ 21:01:53
$ cat hw.li
import time
fn test(n: Integer) {
var start_time = time.Time.clock()
var a : List[Integer] = []
var i = 0
for i in 0...n-1: {
a.push(i)
}
sayln("test Loli: " ++ time.Time.clock() - start_time ++ " Seconds")
}
test(10000000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment