Skip to content

Instantly share code, notes, and snippets.

@rubenwardy
Created June 26, 2016 21:22
Show Gist options
  • Save rubenwardy/d7c8be323758f44cff0a0ebddc5d678d to your computer and use it in GitHub Desktop.
Save rubenwardy/d7c8be323758f44cff0a0ebddc5d678d to your computer and use it in GitHub Desktop.
ruben@rubenPC:~/dev/c_cpp_benchmark$ make
Compiling C test program...
gcc -O0 -Wall -Wextra -lrt -Wno-unused-value -o benchmark-c test.c
Compiling C++ test program...
g++ -O0 -Wall -Wextra -lrt -Wno-unused-value -o benchmark-cxx test.c
C test program running
Iterative programs are run at 100000000 iterations.
[BEGIN] iteration[for](single +1)
[END] took 0.224421024323 seconds
[BEGIN] iteration[while](single +1)
[END] took 0.224649190903 seconds
[BEGIN] iteration[for](single -1)
[END] took 0.224086284637 seconds
[BEGIN] iteration[while](single -1)
[END] took 0.223679065704 seconds
[BEGIN] iteration[for](single +1, single int /3)
[END] took 0.224545240402 seconds
[BEGIN] iteration[while](single +1, single int /3)
[END] took 0.227910518646 seconds
[BEGIN] iteration[for](single +1, single float /3.2)
[END] took 0.228920936584 seconds
[BEGIN] iteration[while](single +1, single float /3.2)
[END] took 0.224041700363 seconds
C++ test program running
Iterative programs are run at 100000000 iterations.
[BEGIN] iteration[for](single +1)
[END] took 0.260012865067 seconds
[BEGIN] iteration[while](single +1)
[END] took 0.255662679672 seconds
[BEGIN] iteration[for](single -1)
[END] took 0.274632692337 seconds
[BEGIN] iteration[while](single -1)
[END] took 0.278836965561 seconds
[BEGIN] iteration[for](single +1, single int /3)
[END] took 0.251992940903 seconds
[BEGIN] iteration[while](single +1, single int /3)
[END] took 0.256284713745 seconds
[BEGIN] iteration[for](single +1, single float /3.2)
[END] took 0.257680177689 seconds
[BEGIN] iteration[while](single +1, single float /3.2)
[END] took 0.249120712280 seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment