Re: Efficiency
- Posted by jbrown105 at speedymail.org Oct 25, 2002
- 550 views
On 0, Don Phillips <EuNexus at yahoo.com> 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 > Yes. concatenating is slow, due to pointer references. First example needs less than the second, for reasons I am not aware of (I dont own the source, so I cant say why, but I suspect its related to pointers). jbrown --