1. RE: ramdisk (was: Re: Changing data types Concluded)

> -----Original Message-----
> From: Allen Robnett [mailto:alrobnett at alumni.princeton.edu]
> Subject: Re: ramdisk (was: Re: Changing data types Concluded)
>
>
>
> Derek wrote:
>
> <<As you have all the bytes in RAM, you do not have to convert them to
> Euphoria integers etc... You can use the RAM-based string
> searching routines
> built in to Windows.
>
> <snip>
>   while offset < FileSize do
>     result = c_func(CompareString,{0, 0, RAMADDR+offset, len,
> FindStr, len})
>     if result = CSTR_ERROR or result = CSTR_EQUAL then
>          exit
>     end if
>     offset += recsize
>   end while
> >>
>
> Euman wrote:
>
> << Make sure you free that allocated string. >>
>
> Kat wrote:
>
> <<No, it means it took 14 sec to find it each time. Which
> sounds bad to me,
> because it means a 200meg file will take about 6 minutes to
> find a record at
> the end. There must be a gotcha somewhere.>>
>
> Many thanks to all for the generous assistance.
> Using Derek's suggested CompareString on my 200MB+ file
> (Pentium 4, 2.53 GHz, 512MB RAM) I got 7.69 seconds for a
> 4-character search string and 8.36 seconds for a 12-character
> search string. (The majority of the fields contained simply
> underscores. The target string was in the last 12-character
> record, number 16,777,216, ending with byte number 201,326,592.)
>
> Modifying the while statement to:
>
>   while offset < FileSize and c_func(CompareString,{0, 0,
> RAMADDR+offset, len, FindStr, len}) != CSTR_EQUAL do
>      offset += recsize
>   end while
>
> resulted in a only a very slight improvement: 7.30 seconds.

CompareString() is a *very* expense method as it takes regional locale
aspects into consideration. It might be better to get a small machine-code
routine written to scan from a RAM address for the first occurance of the
target string.


--
Derek

new topic     » topic index » view message » categorize

2. RE: ramdisk (was: Re: Changing data types Concluded)

Allen V Robnett wrote:

<snip>
 
> I am interested in the possibility of letting the user determine 
> the length of the search string by pressing <ENTER> or <TAB> after 
> entering the desired number of characters to be matched. EU seems 
> to want sequences to be assigned a value which then determines the 
> length. I am considering using a slice to truncate the original 
> sequence length at whatever the length the user indicates. Will 
> this work? Is there a better way?

I think the 'better way' may involve a new design.  What is the logic of 
how records are allocated?  Is there any structured layout behind them?  
If not, might there be a way to do this?

If the answer is still no, you could design an indexing system to help 
you look up the strings.   The fastest way would probably be a suffix 
tree (although it's going to take up a LOT of disk space for something 
this big).  I have some code to build a tree, although it wouldn't work 
for your case, because it's all done in memory, but it could be done in 
files fairly easily.  I'll see if I can get it modified in the next few 
days or so.

Matt Lewis

new topic     » goto parent     » topic index » view message » categorize

3. RE: ramdisk (was: Re: Changing data types Concluded)

RobC, must we get these ads? I wasn't gonna say anything until the ad for 
smoking came along, but given the amount of smoke from fires i haveto 
breathe here, and how sick it makes me, i had to object to marketing 
methods to generate more smoke, and the associated known health effects.

Besides, the ads say to "click on the link below", and if your browser makes 
those urls active, you have a security leak.

Kat

> Menthol Smokers Only! Click on the link below and 
> register to receive up to $50 in savings from one of 
> America's leading menthol brands. 
> http://click.topica.com/caab4S3b1dd66b6Zgfea/ Lorillard

> Are you looking for savings on products you use everyday? 
> Visit Quality Health today and see the coupons, free 
> samples and special offers our members enjoy each and 
> everyday.
> http://click.topica.com/caab3ozb1dd66b6Zgfef/ Ivo Interactive

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu