1. RE: Efficiency

Hi Don,

Actually Don, the code below is faster
> [poking a string into memory]
>      poke( ADDR, STR )           -- poke the string
>      poke( ADDR+length(STR), 0 ) -- poke the null terminator

Think of it this way, it will all vary on the length of string you are 
poking into memory. what if the string is very long, Euphoria would have 
to re-allocate memory for the concat then poke....
why not just poke the string then poke the null... think about it. on my 
old computer 33mhz. i tested and found out the above method was faster.

Jordah

Don Phillips wrote:
> In my off time, I sometimes like to browze a lot of the programs
> in the contributions and vault pages.  Lots of good programs
> and knowledge floating around out there.
> 
> Time and time again, I keep seeing patterns in some of the code.
> In particular, this little snip (or variations of it) crop up
> quite consistantly:
> 
> [poking a string into memory]
>      poke( ADDR, STR )           -- poke the string
>      poke( ADDR+length(STR), 0 ) -- poke the null terminator
> 
> To me, this looks like it would be slower than the following:
> 
> [poking a string into memory]
>      poke( ADDR, STR & 0 )       -- poke the string
> or
>      poke( ADDR, STR & {0} )     -- poke the string
> 
> Is there something about concatenating sequences in Euphoria
> that would slow these two down sufficiently that the first
> example is preferable?
> 
> Don
> 
>

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu