SHA clean-up and (LP64) tune-up.
"Clean-up" stands for the fact that it's using common message digest template ../md32_common.h and sha[1_]dgst.c are reduced down to '#define SHA_[01]' and then '#include "sha_locl.h"'. It stands "(LP64)" there because it's 64 bit platforms which benefit most from the tune-up. The updated code exhibits 40% performance improvement on IRIX64 (sounds too good, huh? I probably should double check if it's not some cache trashing that was holding it back before), 28% - on Alpha Linux and 12% - Solaris 7/64.
This commit is contained in:
@@ -34,6 +34,7 @@ void GetTSC(unsigned long& tsc)
|
||||
#include <stdlib.h>
|
||||
#include <openssl/sha.h>
|
||||
|
||||
#define sha1_block_x86 sha1_block_asm_data_order
|
||||
extern "C" {
|
||||
void sha1_block_x86(SHA_CTX *ctx, unsigned char *buffer,int num);
|
||||
}
|
||||
@@ -55,8 +56,10 @@ void main(int argc,char *argv[])
|
||||
if (num == 0) num=16;
|
||||
if (num > 250) num=16;
|
||||
numm=num+2;
|
||||
#if 0
|
||||
num*=64;
|
||||
numm*=64;
|
||||
#endif
|
||||
|
||||
for (j=0; j<6; j++)
|
||||
{
|
||||
@@ -72,7 +75,7 @@ void main(int argc,char *argv[])
|
||||
sha1_block_x86(&ctx,buffer,num);
|
||||
}
|
||||
|
||||
printf("sha1 (%d bytes) %d %d (%.2f)\n",num,
|
||||
printf("sha1 (%d bytes) %d %d (%.2f)\n",num*64,
|
||||
e1-s1,e2-s2,(double)((e1-s1)-(e2-s2))/2);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user