In a message dated 8/12/2005 8:11:51 AM Pacific Daylight Time, 
[EMAIL PROTECTED] writes:


> every so often X runs out of room and there has to be some
> sort of linking or remapping.  (Recall we're talking about very large
> strings building up to 50,000 fields (was values).)
> So would it make sense to preallocate the space, then do substring
> assignments, and finally trim it:
> 
>    X = SPACE( 1000000 )  ;* reserve a million bytes of memory

I learned something !!
No it's true I swear.
I did know that at first string variables are assigned rather small areas to 
muck about in.  And I knew that as they grew or shrank, these areas were 
reassigned or cleaned-up.  I actually fell upon this knowledge quite by 
accident 
when I was writing a Decompiler and a Workspace Analyzer system.  I think the 
string space originally is just 8 bytes and then gets expanded to 50 then 
150... 
something like that.  At least this was on an ADDS system.
   At any rate, it never occurred to me to pre-allocate space.  This 
certainly would mean that the variable doesnt have to be garbage-collected, at 
least 
until the program is done.
   Also the idea of using sub-string assignment [], instead of <-1> should be 
faster, since this would allow a JMP instead of a SCAN.  You'd have to keep 
track of a PTR for EACH array cell however, not just one for the whole array, 
since each cell would have a different LEN.
    I believe, in this or a prior thread, it was mentioned that LEN Is 
actually a very fast operation, since the length is stored at the head of each 
string as a hiddle variable.  So perhaps you could try just using LEN instead 
of 
maintaining a Pointer for each cell ?
Will Johnson
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to