Page 1 of 1 1
Topic Options
#77306 - 2003-10-31 08:36 AM Script to test String Expressions
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11629
Loc: CA
Jens,

Here is the Post Prepped code with some minor modifications added.

I get the exact same results though as Patrick got in the original thread. The script runs for about 33 seconds and then quits.

This is on a PIII 933MHz with 512MB RAM Windows 2000 SP4

String_Expressions_Test.kix
10/30/2003 11:41PM
Original Topic Thread is here:
http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=14;t=001255

quote:
String Length Start = 0
String Length Final = -769,803,776
String Segment Length = 10,000,000
# Segments To Add = -77
Final String Length (0)=0=0 MB
Script Running Time: 33388

cls
break on
dim $rc
$rc=setoption('NoVarsInStrings','on')
$rc=setoption('Explicit','on')
dim $StartStringLength, $FinalStringLength, $StringSegmentLength, $StringSegmentsToAdd
dim $SegmentCount, $CurrentStringLength, $CurrentSize, $StringSegment
dim $TimerStart, $TimerStop, $TimerTotal
$TimerStart = @TICKS
$StartStringLength = 0
$FinalStringLength = 25000000000
$StringSegmentLength = 10000000
$StringSegmentsToAdd = cdbl($FinalStringLength)/$StringSegmentLength
dim $StringSegmentPart[$StringSegmentLength/1000], $String[cdbl($StartStringLength)/$StringSegmentLength]
$StringSegmentPart = join($StringSegmentPart,'abcdefghij')
$StringSegment = ''
for $SegmentCount = 1 to 100
$StringSegment = $StringSegment+$StringSegmentPart
next
$SegmentCount = 0
if ubound($StartStringLength)
$String=join($String,'abcdefghij')
endif
? 'String Length Start = ' + formatnumber(len($String),0,-1)
? 'String Length Final = ' + formatnumber($FinalStringLength,0,-1)
? 'String Segment Length = ' + formatnumber(len($StringSegment),0,-1)
? '# Segments To Add = ' + formatnumber($StringSegmentsToAdd,0,-1)
while $SegmentCount<$StringSegmentsToAdd and not @ERROR
$String=$String+$StringSegment
$SegmentCount=$SegmentCount+1
$CurrentStringLength=cdbl(len($String))
$CurrentSize=val($CurrentStringLength/1024/1024)
? 'Current String Length ('+formatnumber($SegmentCount,0,-1)+')=' +formatnumber($CurrentStringLength,0,-1)+ '='+formatnumber($CurrentSize,0,-1)+' MB'
loop
$TimerStop = @TICKS
$TimerTotal = $TimerStop-$TimerStart
if not @ERROR
? 'Final String Length ('+formatnumber($SegmentCount,0,-1)+')=' +formatnumber($CurrentStringLength,0,-1)+ '='+formatnumber($CurrentSize,0,-1)+' MB'
? 'Script Running Time: '+$TimerTotal
else
? 'Error at step '+$SegmentCount+'='+formatnumber(len($String),0,-1)+'='+formatnumber(cdbl(len($String))/1024/1024,0,-1)+' MB'
? 'Script Running Time: '+$TimerTotal
endif
exit 0

Top
#77307 - 2003-10-31 03:14 PM Re: Script to test String Expressions
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Use 2,147,483,647 as the final string length, otherwise the number will spill over back into the negative range. It's the integer limitation in KiXtart.
_________________________
There are two types of vessels, submarines and targets.

Top
#77308 - 2003-10-31 03:23 PM Re: Script to test String Expressions
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
that's the reason why the script can't be used.
my script does ubound() on every millionth char thus it's limit is million times int-limit.
_________________________
!

download KiXnet

Top
#77309 - 2003-10-31 04:35 PM Re: Script to test String Expressions
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
This is much more complicated than I originally thought. Not only do you run up against testing string length maximums but you need to worry about exceeding integer lengths while doing this counting. Writing a truly valid script is a challenge. Even if we get this running properly there is the question of how much space is being consumed by the string in reality.

I tend to agree with Richard comments in the original post, this exercise has become mainly an intellectual or thought exercise. It is possible an exact answer may be not be verifiable without a question being posed to Ruud.

Jens,

If it were not for the long run times, I think it would make a good kixgolf game - Counting the uncountable. [Wink]
_________________________
Jack

Top
#77310 - 2003-10-31 10:31 PM Re: Script to test String Expressions
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11629
Loc: CA
Jens,

Can you please update your code to bypass this issue.

quote:
my script does ubound() on every millionth char thus it's limit is million times int-limit
Thanks...

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 988 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.086 seconds in which 0.05 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org