Re: Time this code, please!
- From: johnzulu <johnzulu@xxxxxxxxx>
- Date: Fri, 27 Oct 2006 10:56:49 +0800
Here is my test. I did not get the duo core from my friend to test
out. The results are for PIV 3GHz. mobo using chipset 865.
One Digit Results
time1: 0000000000000FD1
time2: 0000000000000C03
time3: 0000000000000600
Two Digit Results
time1: 0000000000005715
time2: 0000000000002C38
time3: 0000000000002693
Three Digit Results
time1: 00000000000377D1
time2: 0000000000019733
time3: 0000000000017FFA
Four Digit Results
time1: 00000000001DED71
time2: 00000000000F49F7
time3: 00000000000E690B
Five Digit Results
time1: 0000000001160799
time2: 00000000009479F2
time3: 00000000008E35A6
Six Digit Results
time1: 000000000BC12921
time2: 0000000006109B3B
time3: 0000000005B921A1
Seven Digit Results
time1: 000000007A9931D3
time2: 000000003CEF0709
time3: 0000000039BAE941
Eight Digit Results
time1: 00000004B4F8EADC
time2: 000000025B5C2905
time3: 000000023E7B3CF1
Nine Digit Results
time1: 0000002EEAC67080
time2: 0000001785C49881
time3: 0000001665AC7C08
Ten Digit Results
time1: 000000AC4A8F013A
time2: 0000005650C62E4F
time3: 000000521F10900E
John
On 23 Oct 2006 09:20:03 -0700, "randyhyde@xxxxxxxxxxxxx"
<spamtrap@xxxxxxxxxx> wrote:
Hi all,
I'm trying to compare integer to decimal string conversion routines.
Currently, I only have access to a set of Pentium IV machines, which
have lousy shift and multiply times (large number of cycles), so I'd
appreciate it if some of you could run my little test program
(http://webster.cs.ucr.edu/t.exe) on other CPUs and report the results.
This test program runs three different algorithms: a division-based
conversion (slow), a "division by subtraction" algorithm, and a
"division by recipricol multiplication" algorithm (a modified version
of the the Mathisen/AMD optimization guide algorithm). On the PIV, the
"division by subtraction" algorithm seems to be winning, but this is a
suspect result. I'd love to see results on other CPUs to see if this
is an artifact of execution on the PIV or whether the results are real.
Also, if anyone can spot a problem in my measurement, I'd appreciate a
head's up. The results are not intuitive at all. (The source code is
posted below, you can get a copy of the source at
http://webster.cs.ucr.edu/t.hla).
Note: This algorithm converts 32-bit unsigned integers to a string of
characters and the test program runs all four billion possible numbers
and compares the resultant strings (just to ensure that they all
generate the exact same character sequence -- a verification of each
algorithm). This test program took somewhere around a half hour to run
on a 3 GHz PIV, so give it some time on your machine. It's best if
you're not using the machine while running the test.
Cheers,
Randy Hyde
BTW, for the record, here are my results for a 3GHz PIV
(time1-division, time2-subtract, time3-reciprocol):
d:\hla>t
One Digit Results
time1: 0000000000000DC8
time2: 0000000000000718
time3: 000000000000068C
Two Digit Results
time1: 0000000000008204
time2: 00000000000031B4
time3: 0000000000003AB0
Three Digit Results
time1: 000000000004B9E8
time2: 000000000001C34C
time3: 0000000000023288
Four Digit Results
time1: 00000000002F3E7C
time2: 0000000000110BE8
time3: 000000000015F96C
Five Digit Results
time1: 0000000001DB4AB8
time2: 0000000000BB9004
time3: 0000000000DBBAD8
Six Digit Results
time1: 00000000129AE5D0
time2: 0000000006C63EAC
time3: 0000000008BA16A4
Seven Digit Results
time1: 00000000BA63415C
time2: 0000000044481B98
time3: 0000000056A2BA90
Eight Digit Results
time1: 0000000749951A88
time2: 00000002AC305854
time3: 0000000364C5DAD0
Nine Digit Results
time1: 00000048D58FC7A4
time2: 0000001AA67858A8
time3: 00000021E5A7EDA4
Ten Digit Results
time1: 0000010D85309C28
time2: 00000062526B8794
time3: 0000007D38941898
d:\hla>
Source code:
program t;
#include( "stdlib.hhf" )
const
iterations := 1_000_000;
type
intToBuf_t:
procedure
(
d :dword;
width :dword;
var buffer :char in edi
);
?@align:=4;
procedure _intToBuf32
(
d :dword;
width :dword;
var buffer :char in edi
);
@noframe;
@nodisplay;
@noalignstack;
readonly(4)
tens :dword[10] :=
[
1,
10,
100,
1_000,
10_000,
100_000,
1_000_000,
10_000_000,
100_000_000,
1_000_000_000
];
noUSjt :dword[11] :=
[
&badWidth,
&noUS1,
&noUS2,
&noUS3,
&noUS4,
&noUS5,
&noUS6,
&noUS7,
&noUS8,
&noUS9,
&noUS10
];
#macro emitDigit( posn );
xor( edx, edx );
mov( d, eax );
div( tens[posn*4] );
mov( edx, d );
or( '0', al );
mov( al, [edi-posn] );
#endmacro
begin _intToBuf32;
push( ebp );
mov( esp, ebp );
push( eax );
push( ecx );
push( edx );
// Drop down here if we're not outputting underscores inbetween
// groups of four digits in the number.
mov( width, ecx );
cmp( ecx, 10 );
ja badWidth;
jmp( noUSjt[ecx*4] );
noUS10:
emitDigit(9);
noUS9:
emitDigit(8);
noUS8:
emitDigit(7);
noUS7:
emitDigit(6);
noUS6:
emitDigit(5);
noUS5:
emitDigit(4);
noUS4:
emitDigit(3);
noUS3:
emitDigit(2);
noUS2:
emitDigit(1);
noUS1:
emitDigit(0);
sub( width, edi ); // Point EDI at the first char in the buffer
add( 1, edi );
pop( edx );
pop( ecx );
pop( eax );
pop( ebp );
ret( _parms_ );
badWidth:
raise( ex.WidthTooBig );
end _intToBuf32;
procedure _intToBuf32a
(
d :dword;
width :dword;
var buffer :char in edi
);
@noframe;
@nodisplay;
@noalignstack;
readonly(4)
noUSjt :dword[11] :=
[
&badWidth,
&noUS1,
&noUS2,
&noUS3,
&noUS4,
&noUS5,
&noUS6,
&noUS7,
&noUS8,
&noUS9,
&noUS10
];
#macro subDigit( subValue, posn ):done;
mov( '0', dl );
sub( subValue, eax );
jc done;
add( 1, dl );
sub( subValue, eax );
jc done;
add( 1, dl );
sub( subValue, eax );
jc done;
add( 1, dl );
sub( subValue, eax );
jc done;
add( 1, dl );
sub( subValue, eax );
jc done;
add( 1, dl );
sub( subValue, eax );
jc done;
add( 1, dl );
sub( subValue, eax );
jc done;
add( 1, dl );
sub( subValue, eax );
jc done;
add( 1, dl );
sub( subValue, eax );
jc done;
add( 1, dl );
sub( subValue, eax );
done:
add( subValue, eax );
mov( dl, [edi-posn] );
#endmacro
begin _intToBuf32a;
push( ebp );
mov( esp, ebp );
push( eax );
push( edx );
// Drop down here if we're not outputting underscores inbetween
// groups of four digits in the number.
mov( width, ecx );
mov( d, eax );
cmp( ecx, 10 );
ja badWidth;
jmp( noUSjt[ecx*4] );
noUS10:
mov( '1', dl );
sub( 1_000_000_000, eax );
sub( 1_000_000_000, eax );
jc done10;
add( 1, dl );
sub( 1_000_000_000, eax );
jc done10;
add( 1, dl );
sub( 1_000_000_000, eax );
jc done10;
add( 1, dl );
sub( 1_000_000_000, eax );
done10:
add( 1_000_000_000, eax );
mov( dl, [edi-9] );
noUS9:
subDigit( 100_000_000, 8 );
noUS8:
subDigit( 10_000_000, 7 );
noUS7:
subDigit( 1_000_000, 6 );
noUS6:
subDigit( 100_000, 5 );
noUS5:
subDigit( 10_000, 4 );
noUS4:
subDigit( 1_000, 3 );
noUS3:
subDigit( 100, 2 );
noUS2:
subDigit( 10, 1 );
noUS1:
or( '0', al );
mov( al, [edi] );
sub( ecx, edi ); // Point EDI at the first char in the
buffer
add( 1, edi );
pop( edx );
pop( eax );
pop( ebp );
ret( _parms_ );
badWidth:
raise( ex.WidthTooBig );
end _intToBuf32a;
procedure _intToBuf32b
(
d :dword;
width :dword;
var buffer :char in edi
);
@noframe;
@nodisplay;
@noalignstack;
readonly(4)
noUSjt :dword[11] :=
[
&badWidth,
&noUS1,
&noUS2,
&noUS3,
&noUS4,
&noUS5,
&noUS6,
&noUS7,
&noUS8,
&noUS9,
&noUS10
];
pairDigits: char[ 100, 2 ] :=
[
#for( i := 0 to 9 )
['0', char( i + uns8('0')) ],
#endfor
#for( i := 10 to 98 )
[
char( i div 10 + uns8('0')),
char( i mod 10 + uns8('0'))
],
#endfor
[ '9', '9' ]
];
begin _intToBuf32b;
push( ebp );
mov( esp, ebp );
mov( width, ecx );
mov( d, eax );
cmp( ecx, 10 );
ja badWidth;
jmp( noUSjt[ ecx*4 ]);
align(4);
noUS1:
or( '0', al );
mov( al, (type char [edi]) );
pop( ebp );
ret( _parms_ );
align(4);
noUS2:
mov( (type word pairDigits[ eax*2 ]), ax );
mov( ax, [edi] );
pop( ebp );
ret( _parms_ );
align(4);
noUS3:
mov( eax, ecx );
mov( $1000_0000 div 100, edx );
mul( edx );
mov( eax, esi );
and( $3f_ffff, esi );
add( esi, eax );
shr( 28, eax );
mov( eax, edx );
intmul( 100, eax );
sub( eax, ecx );
or( '0', dl );
mov( dl, [edi] );
mov( (type word pairDigits[ ecx*2 ]), ax );
mov( ax, [edi+1] );
mov( 3, ecx );
pop( ebp );
ret( _parms_ );
align(4);
noUS4:
mov( eax, ecx );
mov( $100_0000 div 100, edx );
mul( edx );
mov( eax, esi );
and( $3_ffff, esi );
add( esi, eax );
shr( 24, eax );
mov( eax, edx );
intmul( 100, eax );
sub( eax, ecx );
mov( (type word pairDigits[ edx*2 ]), dx );
mov( (type word pairDigits[ ecx*2 ]), cx );
mov( dx, [edi] );
mov( cx, [edi+2] );
mov( 4, ecx );
pop( ebp );
ret( _parms_ );
align(4);
noUS5:
mov( eax, esi );
mov( $d1b71759, edx );
mul( edx );
shr( 30, eax );
lea( esi, [eax+edx*4+1] );
mov( esi, edx );
shr( 15, edx );
and( $7fff, esi );
or( '0', edx );
mov( dl, [edi] );
lea( edx, [esi+esi*4] );
lea( esi, [esi+esi*4] );
shr( 14, edx );
and( $3fff, esi );
or( '0', edx );
mov( dl, [edi+1] );
lea( edx, [esi+esi*4] );
lea( esi, [esi+esi*4] );
shr( 13, edx );
and( $1fff, esi );
or( '0', edx );
mov( dl, [edi+2] );
lea( edx, [esi+esi*4] );
lea( esi, [esi+esi*4] );
shr( 12, edx );
and( $0fff, esi );
or( '0', edx );
mov( dl, [edi+3] );
lea( edx, [esi+esi*4] );
shr( 11, edx );
or( '0', edx );
mov( dl, [edi+4] );
mov( 5, ecx );
pop( ebp );
ret( _parms_ );
align(4);
noUS6:
mov( eax, esi );
mov( $0a7c5ac47, edx );
mul( edx );
add( $0a7c5ac47, eax );
adc( 0, edx );
shr( 16, edx );
mov( edx, ecx );
intmul( 100_000, edx );
sub( edx, esi );
mov( $d1b71759, eax );
mul( ecx );
shr( 30, eax );
lea( ebx, [eax+edx*4+1] );
mov( $d1b71759, eax );
mul( esi );
shr( 30, eax );
lea( esi, [eax+edx*4+1] );
mov( esi, edx );
and( $7fff, ebx );
lea( ecx, [ebx+ebx*4] );
lea( ebx, [ebx+ebx*4] );
shr( 15, edx );
and( $7fff, esi );
or( '0', edx );
mov( dl, [edi+1] );
lea( edx, [esi+esi*4] );
lea( esi, [esi+esi*4] );
lea( ebx, [ebx+ebx*4] );
shr( 14, edx );
and( $3fff, esi );
or( '0', edx );
mov( dl, [edi+2] );
lea( edx, [esi+esi*4] );
lea( esi, [esi+esi*4] );
lea( ebx, [ebx+ebx*4] );
shr( 13, edx );
and( $1fff, esi );
or( '0', edx );
mov( dl, [edi+3] );
lea( edx, [esi+esi*4] );
lea( esi, [esi+esi*4] );
lea( ecx, [ebx+ebx*4] );
lea( ebx, [ebx+ebx*4] );
shr( 12, edx );
and( $0fff, esi );
or( '0', edx );
mov( dl, [edi+4] );
lea( edx, [esi+esi*4] );
shr( 11, ecx );
and( $0fff, ebx );
or( '0', ecx );
mov( cl, [edi] );
shr( 11, edx );
or( '0', edx );
mov( dl, [edi+5] );
mov( 6, ecx );
pop( ebp );
ret( _parms_ );
align(4);
noUS7:
mov( eax, esi );
mov( $0a7c5ac47, edx );
mul( edx );
add( $0a7c5ac47, eax );
adc( 0, edx );
shr( 16, edx );
mov( edx, ecx );
intmul( 100_000, edx );
sub( edx, esi );
mov( $d1b71759, eax );
mul( ecx );
shr( 30, eax );
lea( ebx, [eax+edx*4+1] );
mov( ebx, ecx );
mov( $d1b71759, eax );
mul( esi );
shr( 30, eax );
lea( esi, [eax+edx*4+1] );
mov( esi, edx );
and( $7fff, ebx );
lea( ebx, [ebx+ebx*4] );
shr( 15, edx );
and( $7fff, esi );
or( '0', edx );
mov( dl, [edi+2] );
lea( edx, [esi+esi*4] );
lea( esi, [esi+esi*4] );
lea( ebx, [ebx+ebx*4] );
shr( 14, edx );
and( $3fff, esi );
or( '0', edx );
mov( dl, [edi+3] );
lea( edx, [esi+esi*4] );
lea( esi, [esi+esi*4] );
lea( ecx, [ebx+ebx*4] );
lea( ebx, [ebx+ebx*4] );
shr( 13, edx );
and( $1fff, esi );
or( '0', edx );
mov( dl, [edi+4] );
lea( edx, [esi+esi*4] );
lea( esi, [esi+esi*4] );
shr( 12, ecx );
and( $0fff, ebx );
or( '0', ecx );
mov( cl, [edi] );
lea( ecx, [ebx+ebx*4] );
lea( ebx, [ebx+ebx*4] );
shr( 12, edx );
and( $0fff, esi );
or( '0', edx );
mov( dl, [edi+5] );
lea( edx, [esi+esi*4] );
shr( 11, ecx );
and( $0fff, ebx );
or( '0', ecx );
mov( cl, [edi+1] );
shr( 11, edx );
or( '0', edx );
mov( dl, [edi+6] );
mov( 10, ecx );
pop( ebp );
ret( _parms_ );
align(4);
noUS8:
mov( eax, esi );
mov( $0a7c5ac47, edx );
mul( edx );
add( $0a7c5ac47, eax );
adc( 0, edx );
shr( 16, edx );
mov( edx, ecx );
intmul( 100_000, edx );
sub( edx, esi );
mov( $d1b71759, eax );
mul( ecx );
shr( 30, eax );
lea( ebx, [eax+edx*4+1] );
mov( ebx, ecx );
mov( $d1b71759, eax );
mul( esi );
shr( 30, eax );
lea( esi, [eax+edx*4+1] );
mov( esi, edx );
and( $7fff, ebx );
lea( ebx, [ebx+ebx*4] );
shr( 15, edx );
and( $7fff, esi );
or( '0', edx );
mov( dl, [edi+3] );
lea( edx, [esi+esi*4] );
lea( esi, [esi+esi*4] );
and( $3fff, ebx );
lea( ecx, [ebx+ebx*4] );
lea( ebx, [ebx+ebx*4] );
shr( 14, edx );
and( $3fff, esi );
or( '0', edx );
mov( dl, [edi+4] );
lea( edx, [esi+esi*4] );
lea( esi, [esi+esi*4] );
shr( 13, ecx );
and( $1fff, ebx );
or( '0', ecx );
mov( cl, [edi] );
lea( ecx, [ebx+ebx*4] );
lea( ebx, [ebx+ebx*4] );
shr( 13, edx );
and( $1fff, esi );
or( '0', edx );
mov( dl, [edi+5] );
lea( edx, [esi+esi*4] );
lea( esi, [esi+esi*4] );
shr( 12, ecx );
and( $0fff, ebx );
or( '0', ecx );
mov( cl, [edi+1] );
lea( ecx, [ebx+ebx*4] );
lea( ebx, [ebx+ebx*4] );
shr( 12, edx );
and( $0fff, esi );
or( '0', edx );
mov( dl, [edi+6] );
lea( edx, [esi+esi*4] );
shr( 11, ecx );
and( $0fff, ebx );
or( '0', ecx );
mov( cl, [edi+2] );
shr( 11, edx );
or( '0', edx );
mov( dl, [edi+7] );
mov( 8, ecx );
pop( ebp );
ret( _parms_ );
align(4);
noUS9:
mov( eax, esi );
mov( $0a7c5ac47, edx );
mul( edx );
add( $0a7c5ac47, eax );
adc( 0, edx );
shr( 16, edx );
mov( edx, ecx );
intmul( 100_000, edx );
sub( edx, esi );
mov( $d1b71759, eax );
mul( ecx );
shr( 30, eax );
lea( ebx, [eax+edx*4+1] );
mov( ebx, ecx );
mov( $d1b71759, eax );
mul( esi );
shr( 30, eax );
lea( esi, [eax+edx*4+1] );
mov( esi, edx );
and( $7fff, ebx );
lea( ecx, [ebx+ebx*4] );
lea( ebx, [ebx+ebx*4] );
shr( 15, edx );
and( $7fff, esi );
or( '0', edx );
mov( dl, [edi+4] );
lea( edx, [esi+esi*4] );
lea( esi, [esi+esi*4] );
shr( 14, ecx );
and( $3fff, ebx );
or( '0', ecx );
mov( cl, [edi] );
lea( ecx, [ebx+ebx*4] );
lea( ebx, [ebx+ebx*4] );
shr( 14, edx );
and( $3fff, esi );
or( '0', edx );
mov( dl, [edi+5] );
lea( edx, [esi+esi*4] );
lea( esi, [esi+esi*4] );
shr( 13, ecx );
and( $1fff, ebx );
or( '0', ecx );
mov( cl, [edi+1] );
lea( ecx, [ebx+ebx*4] );
lea( ebx, [ebx+ebx*4] );
shr( 13, edx );
and( $1fff, esi );
or( '0', edx );
mov( dl, [edi+6] );
lea( edx, [esi+esi*4] );
lea( esi, [esi+esi*4] );
shr( 12, ecx );
and( $0fff, ebx );
or( '0', ecx );
mov( cl, [edi+2] );
lea( ecx, [ebx+ebx*4] );
lea( ebx, [ebx+ebx*4] );
shr( 12, edx );
and( $0fff, esi );
or( '0', edx );
mov( dl, [edi+7] );
lea( edx, [esi+esi*4] );
shr( 11, ecx );
and( $0fff, ebx );
or( '0', ecx );
mov( cl, [edi+3] );
shr( 11, edx );
or( '0', edx );
mov( dl, [edi+8] );
mov( 9, ecx );
pop( ebp );
ret( _parms_ );
align(4);
noUS10:
mov( eax, esi );
mov( $0a7c5ac47, edx );
mul( edx );
add( $0a7c5ac47, eax );
adc( 0, edx );
shr( 16, edx );
mov( edx, ecx );
intmul( 100_000, edx );
sub( edx, esi );
mov( $d1b71759, eax );
mul( ecx );
shr( 30, eax );
lea( ebx, [eax+edx*4+1] );
mov( ebx, ecx );
mov( $d1b71759, eax );
mul( esi );
shr( 30, eax );
lea( esi, [eax+edx*4+1] );
mov( esi, edx );
shr( 15, ecx );
and( $7fff, ebx );
or( '0', ecx );
mov( cl, [edi] );
lea( ecx, [ebx+ebx*4] );
lea( ebx, [ebx+ebx*4] );
shr( 15, edx );
and( $7fff, esi );
or( '0', edx );
mov( dl, [edi+5] );
lea( edx, [esi+esi*4] );
lea( esi, [esi+esi*4] );
shr( 14, ecx );
and( $3fff, ebx );
or( '0', ecx );
mov( cl, [edi+1] );
lea( ecx, [ebx+ebx*4] );
lea( ebx, [ebx+ebx*4] );
shr( 14, edx );
and( $3fff, esi );
or( '0', edx );
mov( dl, [edi+6] );
lea( edx, [esi+esi*4] );
lea( esi, [esi+esi*4] );
shr( 13, ecx );
and( $1fff, ebx );
or( '0', ecx );
mov( cl, [edi+2] );
lea( ecx, [ebx+ebx*4] );
lea( ebx, [ebx+ebx*4] );
shr( 13, edx );
and( $1fff, esi );
or( '0', edx );
mov( dl, [edi+7] );
lea( edx, [esi+esi*4] );
lea( esi, [esi+esi*4] );
shr( 12, ecx );
and( $0fff, ebx );
or( '0', ecx );
mov( cl, [edi+3] );
lea( ecx, [ebx+ebx*4] );
lea( ebx, [ebx+ebx*4] );
shr( 12, edx );
and( $0fff, esi );
or( '0', edx );
mov( dl, [edi+8] );
lea( edx, [esi+esi*4] );
shr( 11, ecx );
and( $0fff, ebx );
or( '0', ecx );
mov( cl, [edi+4] );
shr( 11, edx );
or( '0', edx );
mov( dl, [edi+9] );
mov( 10, ecx );
pop( ebp );
ret( _parms_ );
badWidth:
raise( ex.WidthTooBig );
end _intToBuf32b;
procedure sumValue
(
theValue:dword in esi;
width:dword in ecx;
var buffer:var in edi;
i2b:intToBuf_t
);
var
curTime :dword[2];
begin sumValue;
push( ebx );
push( ecx );
push( esi );
rdtsc();
mov( eax, curTime );
mov( edx, curTime[4] );
i2b( esi, ecx, [edi] );
rdtsc();
sub( curTime, eax );
sbb( curTime[4], edx );
pop( esi );
pop( ecx );
pop( ebx );
end sumValue;
procedure computeTime( start:dword; stop:dword; msg:string );
var
m :dword;
value :dword;
width :dword;
time1 :dword[2];
time2 :dword[2];
time3 :dword[2];
bufptr1 :dword;
bufptr2 :dword;
bufptr3 :dword;
buffer :char[256];
buffer2 :char[256];
buffer3 :char[256];
begin computeTime;
mov( 0, time1 );
mov( 0, time1[4] );
mov( 0, time2 );
mov( 0, time2[4] );
mov( 0, time3 );
mov( 0, time3[4] );
mov( start, eax );
mov( eax, value );
mov( stop, eax );
sub( start, eax );
add( 1, eax );
mov( eax, m );
forlp:
mov( eax, esi );
conv.u32Size( eax );
mov( eax, ecx );
mov( eax, width );
lea( edi, buffer[255] );
sumValue( esi, ecx, [edi], &_intToBuf32 );
add( eax, time1[0] );
adc( edx, time1[4] );
mov( edi, bufptr1 );
lea( edi, buffer2[255] );
sumValue( esi, ecx, [edi], &_intToBuf32a );
add( eax, time2[0] );
adc( edx, time2[4] );
mov( edi, bufptr2 );
lea( edi, buffer );
sumValue( esi, ecx, [edi], &_intToBuf32b );
add( eax, time3[0] );
adc( edx, time3[4] );
mov( edi, bufptr3 );
cld();
mov( width, ecx );
mov( bufptr1, edi );
mov( bufptr2, esi );
repe.cmpsb();
jne failure;
mov( width, ecx );
mov( bufptr1, edi );
mov( bufptr3, esi );
repe.cmpsb();
jne failure;
inc( value );
dec( m );
jnz forlp;
stdout.put( nl, msg, nl );
stdout.put( "time1: ", (type qword time1), nl );
stdout.put( "time2: ", (type qword time2), nl );
stdout.put( "time3: ", (type qword time3), nl );
exit computeTime;
failure:
stdout.put( "Test failed at ", nl );
stdout.write( val bufptr1, width );
stdout.newln();
stdout.write( val bufptr2, width );
stdout.newln();
stdout.write( val bufptr3, width );
stdout.newln();
exit t;
end computeTime;
static
buffer :char[256];
begin t;
computeTime( 0, 9, "One Digit Results" );
computeTime( 10, 99, "Two Digit Results" );
computeTime( 100, 999, "Three Digit Results" );
computeTime( 1_000, 9_999, "Four Digit Results" );
computeTime( 10_000, 99_999, "Five Digit Results" );
computeTime( 100_000, 999_999, "Six Digit Results" );
computeTime( 1_000_000, 9_999_999, "Seven Digit Results" );
computeTime( 10_000_000, 99_999_999, "Eight Digit Results" );
computeTime( 100_000_000, 999_999_999, "Nine Digit Results" );
computeTime( 1_000_000_000, 4_294_967_295, "Ten Digit Results" );
end t;
.
- Prev by Date: Re: 12 Misconceptions
- Next by Date: Re: Survey - Tools with Asm.
- Previous by thread: Re: Time this code, please!
- Next by thread: Need help,thx
- Index(es):
Relevant Pages
|