Re: Skybuck's TryStrToUint64 (Version 0.03, register/simple version)
- From: "Skybuck Flying" <spam@xxxxxxxxxxx>
- Date: Thu, 25 Oct 2007 09:51:03 +0200
Here is the main loop one more time by simply using the Borland/Common
Technique it seems:
// Since the checks are down up top... the multiplication should be safe :)
I am not sure if all the memory look ups from the previous versions would be
fast... so here is an alternative version
which is very simply code by using an extra multiplication, no lookup
tables, and even simpler index handling.
So there are now three different versions to choose from.
Which one is the fastest is hard to say... it might be different per machine
even...
So a benchmark would have to prove which one is fastest ;)
But I am not so much interested in benchmarking and performance.
As long as it's decent performance it's ok.
And the multiplication will probably be pretty fast in true 64 bit mode...
For now it's emulated mode which reduces it's speed a little bit.
For those people interested in assembler and machine workings and string
conversion speeds take your pick and benchmark !
However I have other things to do for now.... and I just need this
conversion routine for some debugging purposes ;)
So speed not an issue for me, at least not today ! ;)
// simple main conversion loop:
// if code reaches here then ok, convert it
for vIndex := 1 to Length(S) do
begin
// Value := Value + (DigitValue[S[Length(S)-(vIndex-1)]] *
DigitPositionValue[vIndex]);
// possible optimization, which uses larger memory table no more multiply:
// maybe all these memory access in 32 bit land not so fast/good so
instead try using
// registers ;)
// Value := Value + DigitPositionValue[S[Length(S)-(vIndex-1)]][vIndex];
// simplest code:
Value := Value * 10 + DigitValue[S[vIndex]];
end;
Bye,
Skybuck.
.
- Prev by Date: Re: Skybuck's TryStrToUint64 (Version 0.01 and Version 0.02)
- Next by Date: Re: Skybuck's TryStrToUint64 (Version 0.03, register/simple version)
- Previous by thread: Skybuck's TryStrToUint64 (Version 0.01 and Version 0.02)
- Next by thread: Re: Skybuck's TryStrToUint64 (Version 0.03, register/simple version)
- Index(es):
Relevant Pages
|