141 lines
2.8 KiB
Plaintext
141 lines
2.8 KiB
Plaintext
# Optimized C
|
|
|
|
|
|
$ make && make time-linux
|
|
gcc -O3 samples.c -fopenmp -lm -o out/samples
|
|
Requires /bin/time, found on GNU/Linux systems
|
|
|
|
Running 100x and taking avg time: OMP_NUM_THREADS=1 out/samples
|
|
Time using 1 thread: 20.20ms
|
|
|
|
Running 100x and taking avg time: OMP_NUM_THREADS=2 out/samples
|
|
Time using 2 threads: 17.50ms
|
|
|
|
Running 100x and taking avg time: OMP_NUM_THREADS=4 out/samples
|
|
Time for 4 threads: 17.00ms
|
|
|
|
Running 100x and taking avg time: OMP_NUM_THREADS=8 out/samples
|
|
Time using 8 threads: 8.40ms
|
|
|
|
Running 100x and taking avg time: OMP_NUM_THREADS=16 out/samples
|
|
Time using 16 threads: 5.00ms
|
|
|
|
# C
|
|
|
|
## normal compilation
|
|
0.888458
|
|
|
|
real 0m0,442s
|
|
user 0m0,378s
|
|
sys 0m0,064s
|
|
|
|
## -Ofast
|
|
0.888458
|
|
|
|
real 0m0.292s
|
|
user 0m0.266s
|
|
sys 0m0.026s
|
|
|
|
# Squiggle
|
|
|
|
real 0m1,536s
|
|
user 0m1,564s
|
|
sys 0m0,240s
|
|
|
|
# NodeJS
|
|
|
|
0.8849940532403973
|
|
|
|
real 0m0,732s
|
|
user 0m0,769s
|
|
sys 0m0,131s
|
|
|
|
|
|
## Python
|
|
|
|
0.8887373869178242
|
|
|
|
real 0m16,641s
|
|
user 0m16,693s
|
|
sys 0m0,517s
|
|
|
|
## R
|
|
[1] 0.885141
|
|
|
|
real 0m7,000s
|
|
user 0m6,944s
|
|
sys 0m0,052s
|
|
|
|
## Nim
|
|
|
|
nim c --verbosity:0 samples.nim && time ./samples --verbosity:0 && echo
|
|
0.8860780498240779
|
|
|
|
real 0m0.234s
|
|
user 0m0.214s
|
|
sys 0m0.020s
|
|
|
|
nim c --verbosity:0 -d:release samples.nim && time ./samples --verbosity:0 && echo
|
|
0.884035098700204
|
|
|
|
real 0m0.074s
|
|
user 0m0.043s
|
|
sys 0m0.031s
|
|
|
|
nim c --verbosity:0 -d:danger samples.nim && time ./samples --verbosity:0
|
|
0.8892827195895541
|
|
|
|
real 0m0.068s
|
|
user 0m0.048s
|
|
sys 0m0.020s
|
|
|
|
— make time-linux
|
|
Requires /bin/time, found on GNU/Linux systems
|
|
|
|
Running 100x and taking avg time of:
|
|
Time: 38.90ms
|
|
|
|
## Squigglepy
|
|
|
|
|
|
— time make run
|
|
python3 samples.py
|
|
100%|█████████████████████████████████████████████████████████████████████████████████████| 4/4 [00:00<00:00, 20.68it/s]
|
|
100%|████████████████████████████████████████████████████████████████████| 1000000/1000000 [00:00<00:00, 1298266.78it/s]
|
|
0.8854926010232937
|
|
|
|
real 0m1.602s
|
|
user 0m1.582s
|
|
sys 0m0.331s
|
|
|
|
## Lua
|
|
|
|
— make time-linux-simple
|
|
Requires /bin/time, found on GNU/Linux systems
|
|
|
|
/bin/time -f "Time: %es" lua samples.lua && echo
|
|
0.88932198462254
|
|
Time: 0.28s
|
|
|
|
— make time-linux
|
|
Requires /bin/time, found on GNU/Linux systems
|
|
|
|
Running 100x and taking avg time of: lua samples.lua
|
|
Time: 275.80ms
|
|
|
|
— make time-linux
|
|
Requires /bin/time, found on GNU/Linux systems
|
|
|
|
Running 100x and taking avg time of: luajit samples.lua
|
|
Time: 68.60ms
|
|
|
|
|
|
## squiggle.c
|
|
|
|
— make time-linux
|
|
Requires /bin/time, found on GNU/Linux systems
|
|
|
|
Running 100x and taking avg time example
|
|
Time using 1 thread: 37.60ms
|
|
|