Loading lang_c_tr_04...
printf("\n~~~~ %s() ~~~~\n", __func__);
#include <stdio.h> #include <sys/time.h>
double // seconds (1e-6 precision) since 1970/01/01 00:00:00 UTC Timing_now(void) { struct timeval tv; gettimeofday(&tv, NULL); return (double)tv.tv_sec+1e-6*(double)tv.tv_usec; }
• tant que la durée choisie n'est pas écoulée : | • pour le nombre de répétitions choisi : | | • invoquer la fonction passée par pointeur | • incrémenter le nombre d'itérations • milliards_d_opérations = 1e-9 × nombre_de_répétitions × nombre_d_itérations × nombre_d_élements_des_tableaux • performance = milliards_d_opérations / durée_effectivement_écouléeDe telles mesures de performances moyennes n'ont de sens que si le nombre d'opérations exécutées est suffisamment grand ; c'est pour cette raison que les opérations sont effectuées pendant une durée assez longue.
//----------------------------------------------------------------------------
#ifndef RANDOM_H #define RANDOM_H
void Random_seed(void);
int // random value in [low;high] (bounds included) Random_int(int low, int high);
void Random_shuffle(void *elements, int elementSize, int elementCount);
#endif // RANDOM_H
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
#include "random.h" #include <stdlib.h> #include <time.h> #include <assert.h>
void Random_seed(void) { srand((unsigned int)time(NULL)); }
int // random value in [low;high] (bounds included) Random_int(int low, int high) { assert(high>=low); const int range=high-low; return low+rand()%(range+1); }
static // internal use void swapBytes(char *bytesA, char *bytesB, int byteCount) { for(int i=0;i<byteCount;++i) { const char a=bytesA[i], b=bytesB[i]; bytesA[i]=b; bytesB[i]=a; } }
void Random_shuffle(void *elements, int elementSize, int elementCount) { char *bytes=(char *)elements; for(int i=0; i<elementCount; ++i) { const int pos=Random_int(i, elementCount-1); if(pos!=i) { swapBytes(bytes+i*elementSize, bytes+pos*elementSize, elementSize); } } }
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
#ifndef TIMING_H #define TIMING_H
double // seconds (1e-6 precision) since 1970/01/01 00:00:00 UTC Timing_now(void);
typedef void (*Timing_Function)(void *destination, const void *source, const void *argument, const int *indices, int dataCount);
double // giga-operations per second Timing_measure(void *destination, const void *source, const void *argument, const int *indices, int dataCount, int repeatCount, Timing_Function function, double minDuration);
#define DECLARE_TIMING_FUNCTION(name) \ void \ name(void *destination, \ const void *source, \ const void *argument, \ const int *indices, \ int dataCount);
DECLARE_TIMING_FUNCTION( Timing_int_add ) DECLARE_TIMING_FUNCTION( Timing_int_sub ) DECLARE_TIMING_FUNCTION( Timing_int_mult ) DECLARE_TIMING_FUNCTION( Timing_int_div ) DECLARE_TIMING_FUNCTION( Timing_int_mod ) DECLARE_TIMING_FUNCTION( Timing_int_neg ) DECLARE_TIMING_FUNCTION( Timing_int_left ) DECLARE_TIMING_FUNCTION( Timing_int_right ) DECLARE_TIMING_FUNCTION( Timing_int_bit_or ) DECLARE_TIMING_FUNCTION( Timing_int_bit_and ) DECLARE_TIMING_FUNCTION( Timing_int_bit_xor ) DECLARE_TIMING_FUNCTION( Timing_int_bit_not ) DECLARE_TIMING_FUNCTION( Timing_int_or ) DECLARE_TIMING_FUNCTION( Timing_int_and ) DECLARE_TIMING_FUNCTION( Timing_int_not ) DECLARE_TIMING_FUNCTION( Timing_double_add ) DECLARE_TIMING_FUNCTION( Timing_double_sub ) DECLARE_TIMING_FUNCTION( Timing_double_mult ) DECLARE_TIMING_FUNCTION( Timing_double_div ) DECLARE_TIMING_FUNCTION( Timing_double_neg ) DECLARE_TIMING_FUNCTION( Timing_int_assign ) DECLARE_TIMING_FUNCTION( Timing_double_assign ) DECLARE_TIMING_FUNCTION( Timing_int_from_double ) DECLARE_TIMING_FUNCTION( Timing_double_from_int ) DECLARE_TIMING_FUNCTION( Timing_sqrt ) DECLARE_TIMING_FUNCTION( Timing_log ) DECLARE_TIMING_FUNCTION( Timing_sin )
#endif // TIMING_H
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
#include "timing.h" #include <stdio.h> #include <sys/time.h> #include <math.h>
double // seconds (1e-6 precision) since 1970/01/01 00:00:00 UTC Timing_now(void) { struct timeval tv; gettimeofday(&tv, NULL); return (double)tv.tv_sec+1e-6*(double)tv.tv_usec; }
double // giga-operations per second Timing_measure(void *destination, const void *source, const void *argument, const int *indices, int dataCount, int repeatCount, Timing_Function function, double minDuration) { const double t0=Timing_now(); double duration=0.0; int iterCount; for(iterCount=0; duration<minDuration; ++iterCount, duration=Timing_now()-t0) { for(int repeat=0; repeat<repeatCount; ++repeat) { function(destination, source, argument, indices, dataCount); } } const double gigaOperationCount=1e-9*repeatCount*iterCount*dataCount; return gigaOperationCount/duration; }
#define DEFINE_TIMING_FUNCTION(name, dstType, srcType, oper) \ void \ name(void *destination, \ const void *source, \ const void *argument, \ const int *indices, \ int dataCount) \ { \ dstType *dst=(dstType *)destination; \ const srcType *src=(srcType *)source; \ const srcType arg=*(const srcType *)argument; \ if(indices) \ { \ for(int i=0; i<dataCount; ++i) \ { \ const int idx=indices[i]; \ dst[idx]=(src[idx])oper(arg); \ } \ } \ else \ { \ for(int i=0; i<dataCount; ++i) \ { \ dst[i]=(src[i])oper(arg); \ } \ } \ }
#define DEFINE_TIMING_FUNCTION_NO_ARG(name, dstType, srcType, oper) \ void \ name(void *destination, \ const void *source, \ const void *argument, \ const int *indices, \ int dataCount) \ { \ dstType *dst=(dstType *)destination; \ const srcType *src=(srcType *)source; \ (void)argument; /* avoid ``unused parameter'' warning */ \ if(indices) \ { \ for(int i=0; i<dataCount; ++i) \ { \ const int idx=indices[i]; \ dst[idx]=oper(src[idx]); \ } \ } \ else \ { \ for(int i=0; i<dataCount; ++i) \ { \ dst[i]=oper(src[i]); \ } \ } \ }
DEFINE_TIMING_FUNCTION ( Timing_int_add, int, int, + ) DEFINE_TIMING_FUNCTION ( Timing_int_sub, int, int, - ) DEFINE_TIMING_FUNCTION ( Timing_int_mult, int, int, * ) DEFINE_TIMING_FUNCTION ( Timing_int_div, int, int, / ) DEFINE_TIMING_FUNCTION ( Timing_int_mod, int, int, % ) DEFINE_TIMING_FUNCTION_NO_ARG( Timing_int_neg, int, int, - ) DEFINE_TIMING_FUNCTION ( Timing_int_left, int, int, >> ) DEFINE_TIMING_FUNCTION ( Timing_int_right, int, int, << ) DEFINE_TIMING_FUNCTION ( Timing_int_bit_or, int, int, | ) DEFINE_TIMING_FUNCTION ( Timing_int_bit_and, int, int, & ) DEFINE_TIMING_FUNCTION ( Timing_int_bit_xor, int, int, & ) DEFINE_TIMING_FUNCTION_NO_ARG( Timing_int_bit_not, int, int, ~ ) DEFINE_TIMING_FUNCTION ( Timing_int_or, int, int, || ) DEFINE_TIMING_FUNCTION ( Timing_int_and, int, int, && ) DEFINE_TIMING_FUNCTION_NO_ARG( Timing_int_not, int, int, ! ) DEFINE_TIMING_FUNCTION ( Timing_double_add, double, double, + ) DEFINE_TIMING_FUNCTION ( Timing_double_sub, double, double, - ) DEFINE_TIMING_FUNCTION ( Timing_double_mult, double, double, * ) DEFINE_TIMING_FUNCTION ( Timing_double_div, double, double, / ) DEFINE_TIMING_FUNCTION_NO_ARG( Timing_double_neg, double, double, - ) DEFINE_TIMING_FUNCTION_NO_ARG( Timing_int_assign, int, int, ) DEFINE_TIMING_FUNCTION_NO_ARG( Timing_double_assign, double, double, ) DEFINE_TIMING_FUNCTION_NO_ARG( Timing_int_from_double, int, double, (int) ) DEFINE_TIMING_FUNCTION_NO_ARG( Timing_double_from_int, double, int, ) DEFINE_TIMING_FUNCTION_NO_ARG( Timing_sqrt, double, double, sqrt ) DEFINE_TIMING_FUNCTION_NO_ARG( Timing_log, double, double, log ) DEFINE_TIMING_FUNCTION_NO_ARG( Timing_sin, double, double, sin )
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
#include <stdio.h> #include "random.h" #include "timing.h"
void test_random(void) { printf("\n~~~~ %s() ~~~~\n", __func__); const int low=-2, high=2; for(int i=0; i<20; ++i) { printf("[%d;%d] --> %d\n", low, high, Random_int(low, high)); #if 0 // assertion failure! printf("[%d;%d] --> %d\n", high, low, Random_int(high, low)); #endif } int data_i[15]; const int count_i=(int)(sizeof(data_i)/sizeof(data_i[0])); for(int i=0; i<count_i; ++i) { data_i[i]=i; } Random_shuffle(data_i, (int)sizeof(data_i[0]), count_i); for(int i=0; i<count_i; ++i) { printf("%d ", data_i[i]); } printf("\n"); double data_d[15]; const int count_d=(int)(sizeof(data_d)/sizeof(data_d[0])); for(int i=0; i<count_d; ++i) { data_d[i]=1.1*i; } Random_shuffle(data_d, (int)sizeof(data_d[0]), count_d); for(int i=0; i<count_d; ++i) { printf("%g ", data_d[i]); } printf("\n"); }
typedef struct { void *destination; const void *source; const void *argument; Timing_Function function; const char *title; } Measure;
#define DATA_COUNT 512 #define REPEAT_COUNT 1024 #define MIN_DURATION 0.5 #define WARM_UP_DURATION (MIN_DURATION*0.1)
void test_timing(void) { printf("\n~~~~ %s() ~~~~\n",__func__); int indices[DATA_COUNT], dst_i[DATA_COUNT], src_i[DATA_COUNT]; double dst_d[DATA_COUNT], src_d[DATA_COUNT]; for(int i=0; i<DATA_COUNT; ++i) { indices[i]=i; src_i[i]=Random_int(1, 100); src_d[i]=0.01*src_i[i]; } Random_shuffle(indices, (int)sizeof(indices[0]), DATA_COUNT); const int int_arg=7; const double double_arg=1.5; Measure measures[]= {{dst_i, src_i, &int_arg, Timing_int_add, "i+N" }, {dst_i, src_i, &int_arg, Timing_int_sub, "i-N" }, {dst_i, src_i, &int_arg, Timing_int_mult, "i*N" }, {dst_i, src_i, &int_arg, Timing_int_div, "i/N" }, {dst_i, src_i, &int_arg, Timing_int_mod, "i%N" }, {dst_i, src_i, NULL, Timing_int_neg, "-i" }, {dst_i, src_i, &int_arg, Timing_int_left, "i<<N"}, {dst_i, src_i, &int_arg, Timing_int_right, "i>>N"}, {dst_i, src_i, &int_arg, Timing_int_bit_or, "i|N" }, {dst_i, src_i, &int_arg, Timing_int_bit_and, "i&N" }, {dst_i, src_i, &int_arg, Timing_int_bit_xor, "i^N" }, {dst_i, src_i, NULL, Timing_int_bit_not, "~i" }, {dst_i, src_i, &int_arg, Timing_int_or, "i||N"}, {dst_i, src_i, &int_arg, Timing_int_and, "i&&N"}, {dst_i, src_i, NULL, Timing_int_not, "!i" }, {dst_d, src_d, &double_arg, Timing_double_add, "d+X" }, {dst_d, src_d, &double_arg, Timing_double_sub, "d-X" }, {dst_d, src_d, &double_arg, Timing_double_mult, "d*X" }, {dst_d, src_d, &double_arg, Timing_double_div, "d/X" }, {dst_d, src_d, NULL, Timing_double_neg, "-d" }, {dst_i, src_i, NULL, Timing_int_assign, "i=i" }, {dst_d, src_d, NULL, Timing_double_assign, "d=d" }, {dst_i, src_d, NULL, Timing_int_from_double, "i=d" }, {dst_d, src_i, NULL, Timing_double_from_int, "d=i" }, {dst_d, src_d, NULL, Timing_sqrt, "sqrt"}, {dst_d, src_d, NULL, Timing_log, "log" }, {dst_d, src_d, NULL, Timing_sin, "sin" }}; const int measureCount=(int)(sizeof(measures)/sizeof(measures[0])); for(int i=0; i<measureCount; ++i) { const Measure *m=measures+i; Timing_measure(m->destination, m->source, m->argument, indices, DATA_COUNT, REPEAT_COUNT, m->function, WARM_UP_DURATION); const double perf=Timing_measure(m->destination, m->source, m->argument, indices, DATA_COUNT, REPEAT_COUNT, m->function, MIN_DURATION); printf("indirect %s\t%g Gop/s\n", m->title, perf); } for(int i=0;i<measureCount;++i) { const Measure *m=measures+i; Timing_measure(m->destination, m->source, m->argument, NULL, DATA_COUNT, REPEAT_COUNT, m->function, WARM_UP_DURATION); const double perf=Timing_measure(m->destination, m->source, m->argument, NULL, DATA_COUNT, REPEAT_COUNT, m->function, MIN_DURATION); printf(" direct %s\t%g Gop/s\n", m->title, perf); } }
int main(void) { Random_seed(); test_random(); test_timing(); return 0; }
//----------------------------------------------------------------------------
############################################################################## # Intel Core i7-3840QM 2.80GHz, 64bits
~~~~ test_timing() ~~~~ indirect i+N 1.83959 Gop/s indirect i-N 1.84107 Gop/s indirect i*N 1.83189 Gop/s indirect i/N 0.418642 Gop/s indirect i%N 0.418499 Gop/s indirect -i 1.79093 Gop/s indirect i<<N 1.66304 Gop/s indirect i>>N 1.66325 Gop/s indirect i|N 1.84024 Gop/s indirect i&N 1.78665 Gop/s indirect i^N 1.84111 Gop/s indirect ~i 1.8018 Gop/s indirect i||N 1.25524 Gop/s indirect i&&N 1.25266 Gop/s indirect !i 1.26327 Gop/s indirect d+X 1.82805 Gop/s indirect d-X 1.77508 Gop/s indirect d*X 1.82418 Gop/s indirect d/X 1.82074 Gop/s indirect -d 1.82324 Gop/s indirect i=i 1.79066 Gop/s indirect d=d 1.85347 Gop/s indirect i=d 1.69441 Gop/s indirect d=i 1.77629 Gop/s indirect sqrt 0.191248 Gop/s indirect log 0.0499849 Gop/s indirect sin 0.0793114 Gop/s direct i+N 6.58038 Gop/s direct i-N 6.04227 Gop/s direct i*N 6.02324 Gop/s direct i/N 0.418474 Gop/s direct i%N 0.418283 Gop/s direct -i 6.05865 Gop/s direct i<<N 4.62009 Gop/s direct i>>N 4.62282 Gop/s direct i|N 8.39952 Gop/s direct i&N 8.40147 Gop/s direct i^N 8.40192 Gop/s direct ~i 8.43338 Gop/s direct i||N 4.63582 Gop/s direct i&&N 4.29492 Gop/s direct !i 5.97829 Gop/s direct d+X 4.59626 Gop/s direct d-X 4.86134 Gop/s direct d*X 4.5868 Gop/s direct d/X 4.60128 Gop/s direct -d 4.60847 Gop/s direct i=i 9.84985 Gop/s direct d=d 5.86547 Gop/s direct i=d 6.42135 Gop/s direct d=i 6.46187 Gop/s direct sqrt 0.539122 Gop/s direct log 0.204552 Gop/s direct sin 0.167194 Gop/s
############################################################################## # Carte de développement ATMEL, SoC AT91SAM9261 (merci à Éric Boucharé) # ARM926-EJS 200MHz, 32bits, no FPU, 16ko cache D, # 16ko cache I, 64Mo RAM, BUS 100MHz # jeu d'instructions : armv5te
~~~~ test_timing() ~~~~ indirect i+N 0.0196119 Gop/s indirect i-N 0.0196105 Gop/s indirect i*N 0.0163637 Gop/s indirect i/N 0.00362543 Gop/s indirect i%N 0.00263128 Gop/s indirect -i 0.0195987 Gop/s indirect i<<N 0.0191373 Gop/s indirect i>>N 0.0191325 Gop/s indirect i|N 0.0196039 Gop/s indirect i&N 0.0195969 Gop/s indirect i^N 0.0196071 Gop/s indirect ~i 0.0196219 Gop/s indirect i||N 0.016022 Gop/s indirect i&&N 0.0160321 Gop/s indirect !i 0.0174598 Gop/s indirect d+X 0.00187663 Gop/s indirect d-X 0.00181987 Gop/s indirect d*X 0.00243284 Gop/s indirect d/X 0.00238373 Gop/s indirect -d 0.013537 Gop/s indirect i=i 0.0217843 Gop/s indirect d=d 0.015348 Gop/s indirect i=d 0.00879755 Gop/s indirect d=i 0.00352865 Gop/s indirect sqrt 7.32714e-05 Gop/s indirect log 4.56766e-05 Gop/s indirect sin 8.93514e-05 Gop/s direct i+N 0.0361976 Gop/s direct i-N 0.036171 Gop/s direct i*N 0.0283739 Gop/s direct i/N 0.00389131 Gop/s direct i%N 0.00274457 Gop/s direct -i 0.0362094 Gop/s direct i<<N 0.0305855 Gop/s direct i>>N 0.0306098 Gop/s direct i|N 0.036146 Gop/s direct i&N 0.0361589 Gop/s direct i^N 0.0361493 Gop/s direct ~i 0.0362106 Gop/s direct i||N 0.0264748 Gop/s direct i&&N 0.0264559 Gop/s direct !i 0.0306043 Gop/s direct d+X 0.00201474 Gop/s direct d-X 0.00186952 Gop/s direct d*X 0.0025189 Gop/s direct d/X 0.00243103 Gop/s direct -d 0.0206119 Gop/s direct i=i 0.0379935 Gop/s direct d=d 0.0242912 Gop/s direct i=d 0.0103125 Gop/s direct d=i 0.00392656 Gop/s direct sqrt 7.36783e-05 Gop/s direct log 4.58547e-05 Gop/s direct sin 8.99078e-05 Gop/s
############################################################################## # Beagleboard XM, SoC Texas Instrument DM3730 (merci à Éric Boucharé) # ARM Cortex-A8 800MHz, 32bits, no FPU, 16ko cache D, 16ko cache I, 512Mo RAM # jeu d'instructions : armv7-a
~~~~ test_timing() ~~~~ indirect i+N 0.093255 Gop/s indirect i-N 0.0932889 Gop/s indirect i*N 0.0650597 Gop/s indirect i/N 0.0207186 Gop/s indirect i%N 0.0158021 Gop/s indirect -i 0.0931697 Gop/s indirect i<<N 0.0871284 Gop/s indirect i>>N 0.0873446 Gop/s indirect i|N 0.0933576 Gop/s indirect i&N 0.093255 Gop/s indirect i^N 0.0932719 Gop/s indirect ~i 0.0873817 Gop/s indirect i||N 0.0799449 Gop/s indirect i&&N 0.0800271 Gop/s indirect !i 0.086086 Gop/s indirect d+X 0.0125096 Gop/s indirect d-X 0.012534 Gop/s indirect d*X 0.0114131 Gop/s indirect d/X 0.0110475 Gop/s indirect -d 0.0742178 Gop/s indirect i=i 0.0954668 Gop/s indirect d=d 0.101532 Gop/s indirect i=d 0.0590018 Gop/s indirect d=i 0.0257554 Gop/s indirect sqrt 0.000431341 Gop/s indirect log 0.00028014 Gop/s indirect sin 0.000506497 Gop/s direct i+N 0.215048 Gop/s direct i-N 0.214957 Gop/s direct i*N 0.096879 Gop/s direct i/N 0.0218032 Gop/s direct i%N 0.0166089 Gop/s direct -i 0.214919 Gop/s direct i<<N 0.183366 Gop/s direct i>>N 0.183619 Gop/s direct i|N 0.214853 Gop/s direct i&N 0.214788 Gop/s direct i^N 0.214801 Gop/s direct ~i 0.183854 Gop/s direct i||N 0.145681 Gop/s direct i&&N 0.145574 Gop/s direct !i 0.175037 Gop/s direct d+X 0.0129939 Gop/s direct d-X 0.0128762 Gop/s direct d*X 0.0117069 Gop/s direct d/X 0.0111696 Gop/s direct -d 0.105745 Gop/s direct i=i 0.255728 Gop/s direct d=d 0.138673 Gop/s direct i=d 0.0655086 Gop/s direct d=i 0.0280683 Gop/s direct sqrt 0.000432961 Gop/s direct log 0.000280515 Gop/s direct sin 0.000507364 Gop/s
############################################################################## # Raspberry Pi 3 (merci à Éric Boucharé) # ARM Cortex-a53, 1.2GHz, 64bits (mais en mode 32bits), FPU. # jeu d'instructions : armv8-a
~~~~ test_timing() ~~~~ indirect i+N 0.191182 Gop/s indirect i-N 0.196345 Gop/s indirect i*N 0.147839 Gop/s indirect i/N 0.0290563 Gop/s indirect i%N 0.024731 Gop/s indirect -i 0.196944 Gop/s indirect i<<N 0.148129 Gop/s indirect i>>N 0.148892 Gop/s indirect i|N 0.197455 Gop/s indirect i&N 0.19799 Gop/s indirect i^N 0.197863 Gop/s indirect ~i 0.197497 Gop/s indirect i||N 0.148891 Gop/s indirect i&&N 0.147772 Gop/s indirect !i 0.148835 Gop/s indirect d+X 0.0918345 Gop/s indirect d-X 0.0918428 Gop/s indirect d*X 0.0918363 Gop/s indirect d/X 0.0916191 Gop/s indirect -d 0.091841 Gop/s indirect i=i 0.237136 Gop/s indirect d=d 0.148752 Gop/s indirect i=d 0.0846583 Gop/s indirect d=i 0.119268 Gop/s indirect sqrt 0.0386004 Gop/s indirect log 0.00560664 Gop/s indirect sin 0.00509598 Gop/s direct i+N 0.38958 Gop/s direct i-N 0.389185 Gop/s direct i*N 0.237041 Gop/s direct i/N 0.029922 Gop/s direct i%N 0.0254554 Gop/s direct -i 0.389835 Gop/s direct i<<N 0.294658 Gop/s direct i>>N 0.294669 Gop/s direct i|N 0.389586 Gop/s direct i&N 0.3896 Gop/s direct i^N 0.389418 Gop/s direct ~i 0.389591 Gop/s direct i||N 0.236743 Gop/s direct i&&N 0.236277 Gop/s direct !i 0.23659 Gop/s direct d+X 0.148795 Gop/s direct d-X 0.14879 Gop/s direct d*X 0.148794 Gop/s direct d/X 0.148077 Gop/s direct -d 0.148745 Gop/s direct i=i 0.390962 Gop/s direct d=d 0.390795 Gop/s direct i=d 0.148514 Gop/s direct d=i 0.148752 Gop/s direct sqrt 0.0460109 Gop/s direct log 0.00573488 Gop/s direct sin 0.00516158 Gop/s
############################################################################## # Intel Pentium M735 1.4GHz, 32bits (merci à Éric Boucharé)
~~~~ test_timing() ~~~~ indirect i+N 0.273549 Gop/s indirect i-N 0.255591 Gop/s indirect i*N 0.262277 Gop/s indirect i/N 0.0990823 Gop/s indirect i%N 0.101989 Gop/s indirect -i 0.233096 Gop/s indirect i<<N 0.163546 Gop/s indirect i>>N 0.151263 Gop/s indirect i|N 0.27226 Gop/s indirect i&N 0.278911 Gop/s indirect i^N 0.275154 Gop/s indirect ~i 0.233321 Gop/s indirect i||N 0.245461 Gop/s indirect i&&N 0.200547 Gop/s indirect !i 0.26622 Gop/s indirect d+X 0.331598 Gop/s indirect d-X 0.330286 Gop/s indirect d*X 0.324657 Gop/s indirect d/X 0.325571 Gop/s indirect -d 0.329876 Gop/s indirect i=i 0.260669 Gop/s indirect d=d 0.322333 Gop/s indirect i=d 0.245699 Gop/s indirect d=i 0.300655 Gop/s indirect sqrt 0.0201244 Gop/s indirect log 0.0187329 Gop/s indirect sin 0.0144478 Gop/s direct i+N 0.395487 Gop/s direct i-N 0.396714 Gop/s direct i*N 0.204487 Gop/s direct i/N 0.100616 Gop/s direct i%N 0.101096 Gop/s direct -i 0.375017 Gop/s direct i<<N 0.378166 Gop/s direct i>>N 0.377714 Gop/s direct i|N 0.389614 Gop/s direct i&N 0.391616 Gop/s direct i^N 0.391153 Gop/s direct ~i 0.390462 Gop/s direct i||N 0.355413 Gop/s direct i&&N 0.335952 Gop/s direct !i 0.335774 Gop/s direct d+X 0.333134 Gop/s direct d-X 0.333317 Gop/s direct d*X 0.330232 Gop/s direct d/X 0.330707 Gop/s direct -d 0.332363 Gop/s direct i=i 0.396652 Gop/s direct d=d 0.44141 Gop/s direct i=d 0.340857 Gop/s direct d=i 0.370902 Gop/s direct sqrt 0.0241172 Gop/s direct log 0.0197414 Gop/s direct sin 0.0139517 Gop/s
############################################################################## # Intel Core i5-3320 2.6GHz, 64bits (merci à Éric Boucharé)
~~~~ test_timing() ~~~~ indirect i+N 1.50667 Gop/s indirect i-N 1.51488 Gop/s indirect i*N 1.50969 Gop/s indirect i/N 0.362147 Gop/s indirect i%N 0.3624 Gop/s indirect -i 1.52113 Gop/s indirect i<<N 1.08782 Gop/s indirect i>>N 1.08418 Gop/s indirect i|N 1.53008 Gop/s indirect i&N 1.53312 Gop/s indirect i^N 1.506 Gop/s indirect ~i 1.55224 Gop/s indirect i||N 1.07047 Gop/s indirect i&&N 1.03056 Gop/s indirect !i 1.07466 Gop/s indirect d+X 1.07756 Gop/s indirect d-X 1.52598 Gop/s indirect d*X 1.09891 Gop/s indirect d/X 1.1006 Gop/s indirect -d 1.50734 Gop/s indirect i=i 1.59964 Gop/s indirect d=d 1.59962 Gop/s indirect i=d 1.09457 Gop/s indirect d=i 1.0925 Gop/s indirect sqrt 0.164944 Gop/s indirect log 0.0337413 Gop/s indirect sin 0.00866332 Gop/s direct i+N 5.29657 Gop/s direct i-N 5.25179 Gop/s direct i*N 5.29677 Gop/s direct i/N 0.362397 Gop/s direct i%N 0.362124 Gop/s direct -i 5.25759 Gop/s direct i<<N 4.32267 Gop/s direct i>>N 4.32987 Gop/s direct i|N 7.29021 Gop/s direct i&N 7.29756 Gop/s direct i^N 7.21188 Gop/s direct ~i 7.51925 Gop/s direct i||N 4.04663 Gop/s direct i&&N 5.15591 Gop/s direct !i 5.27016 Gop/s direct d+X 4.04091 Gop/s direct d-X 4.0355 Gop/s direct d*X 4.03166 Gop/s direct d/X 3.75604 Gop/s direct -d 3.72344 Gop/s direct i=i 7.62871 Gop/s direct d=d 3.8066 Gop/s direct i=d 5.0448 Gop/s direct d=i 4.76222 Gop/s direct sqrt 0.45602 Gop/s direct log 0.0338447 Gop/s direct sin 0.00871967 Gop/s
##############################################################################