Page 1 of 1 1
Topic Options
#133629 - 2005-02-11 04:11 AM Maximum length of literal string ...
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Been doing some farting around with Kixtart literal (constant) strings ... been trying to embed some very large base64 encoded data into my scripts, for a scripted resource experiment over at kixforms.org - anyways, I remember we chatted about maximum string lengths some time ago - we even ran some benchmarks and tests and we made some very big strings indeed, but in terms of literal strings, like this ...

$x = "This is a string..."

It seems the maximum size is exactly 32000 bytes - the interesting thing is that one can append maxed-out strings together, to create the bigger strings ... like this:

$reallyBigString = $maxedOutString1 + $maxedOutString2

The length (as reported by Len()), will be exactly 64000 bytes. Just some fyi.


Top
#133630 - 2005-02-11 04:21 AM Re: Maximum length of literal string ...
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Just found that its OK to create very large strings using a bit of string math trickery, like this:

$string = "32000chars..." + "32000chars..." + "32000chars..."

Top
#133631 - 2005-02-11 05:10 PM Re: Maximum length of literal string ...
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Yeah, i dont know when the string limit was "broken", think it was with kix 4.x.

here is a snipit of code that i was using to produce a 800k string to save to a file.

Code:

break on


function makeline
dim $line
do
$line = $line + chr(rnd(300))
until len($line) = 50
$makeline = $line
endfunction

while len($data) < 800000
$data = makeline +
makeline +
makeline +
makeline +
makeline +
makeline +
makeline +
makeline +
makeline +
makeline +
makeline +
makeline +
makeline +
makeline +
makeline +
makeline +
makeline +
makeline +
makeline +
makeline + $data

? len($data)
loop
$ = open(1,"800k.txt",5)
$ = writeline(1,$data)


Top
#133632 - 2005-02-12 01:03 AM Re: Maximum length of literal string ...
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
I think we took it to a couple of hundred MBs once during this 'benchmark'
_________________________
There are two types of vessels, submarines and targets.

Top
#133633 - 2005-02-12 03:59 AM Re: Maximum length of literal string ...
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11629
Loc: CA
Here are some previous links dealing with this issue.

POLL: String Expressions
http://www.kixtart.org/ubbthreads/showflat.php?Cat=&Number=105049

Script to test String Expressions
http://www.kixtart.org/ubbthreads/showflat.php?Cat=&Board=UBB2&Number=77020

Top
Page 1 of 1 1


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

Who's Online
1 registered (Allen) and 675 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.107 seconds in which 0.079 seconds were spent on a total of 12 queries. Zlib compression enabled.

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