View Full Version : textanalyse: how fast is your machine?
Lionheart008
22-03-2009, 00:21
hi all:)
dear thinbasic users... can you please test this script and give your the result??? my pc and my notebook has calculated very different results... (0.35-1.37 seconds)... thank you! :)
I have found by chance some minutes before an old script example about speed and text analyses. - I have changed it a little with some new names of FC Bayern Munich (german bundesliga soccer team) and other fictive members... have done it just for FUN, only for this script example! ;)
you can test the script and say how fast is your machine? How many seconds do you need? If you like you can set the repeats for the string bytes higher (perhaps 1000), I took 500 for the first test period :)
my old notebook has a broken leg and not enough to eat and needs 1.67 seconds, so I can imagine, I am the absolute losers for sprinting duel :lol:
have fun with this little, but very, very interesting script, bye, Lionheart
Petr Schreiber
22-03-2009, 15:27
Hi Frank,
for such a delicate timings, I would recommend to use HiResTimer - it is 1000x more precise than GetTickCount ( for real, this is not marketing shout :) )
With HiResTimer, I get timing of 0.650 +- 0.005.
Here is the code listing:
dim inString as string = repeat$(500, "Hi, dear FC Bayern Munich friends, who will win the german bundesliga soccer cup ?"+CHR$(0))
dim t1, t2 as quad
hiResTimer_Init
t1 = hiResTimer_Get
dim stringLen as long = len(inString)
dim outString(256) as string
dim i as long
dim SpecialNames as string = "FC Bayern Munich Soccer Team: Lukas, Bastian, Frank, Miro, Tina, Tamara, Rosanna, Paul, Pete, Roberta, Claus, Jogi, Maria, Norbert, Franzi, Sonja, Ute, Petra, Beate, Vanessa, Lydia, Ninette, Ulli, Xavier, Cesar, Cleopatra, Jens, Eric, Hanny, Doro, Ulli, Inge, Boris, Oliver, Soriah"
dim Characters(256) as long
for i = 1 to stringLen
Characters( asc(inString, i)+1 ) += 1
next
for i = 1 to 256
if Characters(i) > 0 then outString(i) = Characters(i)+$TAB+iif$( i<34, PARSE$( SpecialNames,",!",i), chr$(i-1))
next
array sort outString(i), descend
t2 = hiResTimer_Get
msgbox 0, "Result of text analysis ("+STR$(stringLen)+" bytes)"+$CRLF+$CRLF+trim$(join$(outString, $CRLF), $CRLF)+$CR+$CR+"Operation took:"+STR$( (t2-t1)/1000000, 3)+" finished in seconds" , %MB_OK or %MB_ICONINFORMATION, "Result of soccer team after 500 repeats :) "
Petr
marcuslee
22-03-2009, 16:16
At repeating the string 500 times, it took 0.531 seconds to analyze. I doubled the repeat to 1,000 times, and then it took 2.22 seconds.
I did have a hard time following the script. Part of the following code confuses me.
IF Characters( i ) > 0 THEN _
outString( i ) = Characters( i ) + $TAB + _
IIF$( i < 34, PARSE$( SpecialNames, ",!", i ), _
CHR$( i - 1 ))
Specifically, I don't understand what is being accomplished with this piece:
i < 34
I looked up the ascii table, and I can't figure out why you chose 34. Perhaps I am sleep deprived.
Mark
Lionheart008
23-03-2009, 12:29
short reply:)
hi mark, thank you for your result! good to see that my notebook isn't fast enough to calculate such things... ;)
'i<34' was only a number I have copied, you must take minimum 2 for functionality of the list... when you change the number to 500 or 1000 you can see the list inputs are climbing up...
more will come, thanks, bye, Lionheart
Michael Hartlef
23-03-2009, 14:42
Hi franck,
I didn't feel well the last days and so could not test your stuff. I get an average of 0.490 seconds in your script.
Michael
Lionheart008
23-03-2009, 22:03
hi michael:) thank you for testing and your result! :) good luck for healing process... for body and mind:))) wish you the best, bye, Lionheart
@ petr: forgotten to say thank you too:) ! ;) for script input and result! :D
nice 'wanted' tbgl batman picture, how is this??? :lol: times they are a changing.... singing... ;)
LIONHEART:
Using Petr's version with the hi-res timer, my range of results over about 20 runs was:
Shortest time = 0.407 sec.
Longest time = 0.412 sec.
Don
Lionheart008
28-03-2009, 19:54
hi all,
@don...
thank you for testing and giving your result... it helps!
have done a new example, I attach here my little example... with a little input box at the end and all with console...
this example for testspeedanalyse is finished for me :D
ciao and good evening, bye, Lionheart go for dancing :)