Benchmark for some basic type operations.

This program benchmarks the following operations:

  • Bit testing by Gcc
  • Logical shifts,
  • Operations on basic types (char, short, long, long long).
NameTimeTicks
Empty bench (correction) 8 us[17]
Char mul (68) 11 us[22]
Char add (136) 3 us[7]
Char neg (120) 3 us[7]
Char div (40) 29 us[58]
Short mul (23184) 51 us[102]
Short add (-19168) 6 us[13]
Short neg (19168) 8 us[16]
Short div (6389) 42 us[85]
Long mul (-621105295) 229 us[459]
Long add (-1242210590) 32 us[64]
Long neg (1242210590) 41 us[82]
Long div (414070196) 4933 us[9866]
Long long mul (414070196) 898 us[1797]
Long long add (414070196) 28 us[56]
Long long neg (414070196) 271 us[543]
Long long div (414070196) 12993 us[25987]
Shift right 1 (char) 3 us[6]
Shift right 1 (short) 7 us[15]
Shift right 1 (long) 15 us[30]
Shift right 1 (long long) 33 us[67]
Shift left 1 (char) 3 us[6]
Shift left 1 (short) 7 us[15]
Shift left 1 (long) 18 us[37]
Shift left 1 (long long) 33 us[67]
Bit count (char, 8 bits set) 82 us[164]
Bit count (short, 16 bits set) 660 us[1320]
Bit count (long, 32 bits set) 2185 us[4371]
Bit count (long long, 64 bits set) 7346 us[14692]
Source file: bench-basic.c