TIP: Click on subject to list as thread! ANSI
echo: qedit
to: ALL
from: `CARLO HOGEVEEN`
date: 1998-03-27 08:05:00
subject: Re: Set/GetGlobalStr - speed/limit ?

From: "Carlo Hogeveen" 
-----Original Message-----
From: Chris Antos (Exchange) 
To: 'dBit AS' ; tsepro@semware.com 
Date: Wednesday, March 25, 1998 6:59 PM
Subject: RE: Set/GetGlobalStr - speed/limit ?
>i think a better way to do arrays is to use a buffer.  use
CreateTempBuffer,
>and make each line be an element in the array.
>
>or in the case of your customer.lst, i think it's already in an array
>format, really.  just create a temp buffer and load your customer.lst file.
>you can use lFind("10005", "^g") to find record 10005 (the ^ means the
>string must appear at the beginning of the line which in your case seems to
>be how customer.lst is formatted).
Actually, this is how setglobalstr() and getglobalstr() internally work,
with a hidden buffer, in which the variable name (alias the key value)
is the first word on each line (alias reacord), so that part would be
pointless to program ourselves.
To answer part of the original question: because getglobalstr() and
setglobalstr() work with a hidden file, the number of session global
variables you can add is only limited by internal memory and TSE's
disc swap space.
> if the file is really large and is in
>sorted order, you can even write your own binary search routine to improve
>search speed.
Yes, here you can beat getglobalstr().
Setglobalsstr() adds new variables (keys) to the begin of the hidden buffer,
so getglobalstr() can not do a binary search and is "slow".
>
>//chris
>
Carlo
>
>
>
>-----Original Message-----
>From: dBit AS [mailto:dbit@sn.no]
>Sent: Wednesday, March 25, 1998 3:02 AM
>To: tsepro@semware.com
>Subject: Set/GetGlobalStr - speed/limit ?
>
>
>I have tried using the GetGlobalStr function for a kind of "associative
>arrays" (like Perl).
>
>  EditFile("customer.lst")   --->   10001Customer name # 1
>  Repeat                            10002Customer name # 2....
>    Key = GetText(1,5)
>    Data = GetText(6,30)
>    SetGlobalStr(Key,Data)
>    StopIt()
>    Message(CurrLine())
>  Until Not Down()
>
>After about 255 (I guess) loops this slows down significantly.  Is there
>a smarter way to accomplish this ?  How many SetGlobalStr/Int variables
>can be created - are there any limit at all ??
>
>By the way: I finally got my 2.5 .UI converted to 2.8 - ready for 3.0 :)
>
>- SOI -
>
>
---
---------------
* Origin: apana>>>>>fidonet [sawasdi.apana.org.au] (3:800/846.13)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.