Re: g_strjoinv() is very slow

David Odin <David Odin bigfoot com> writes:
> On Sat, Sep 23, 2000 at 08:17:01PM +0100, Joel Becker wrote:
> > On Sat, Sep 23, 2000 at 06:51:48PM +0200, David Odin wrote:
> > > On Sat, Sep 23, 2000 at 12:40:32PM -0400, Havoc Pennington wrote:
> > >    I also think the same optimisations could be done with g_strjoin() and
> > > g_strconcat(). I'll have a look.
> > 
> > 	Maybe I'm a pedant, but I suspect we should find out what other
> > platforms perform like.  I know that lots of them use inline ASM for
> > these functions.  Maybe a test case in configure to decide?
> > 
>   Here is my point:
>    To perform a strcat(), you have to first find the end of the first string,
> and then copy the second one in that place. It will always be slower than
> only perform the copy.
>    OK. In my algorithm, I use strlen(), but it is only used on the added
> string, which is obviously shorter than the resulting one.

Maybe this should be re-written to use stpcpy instead -- stpcpy
returns the pointer to the end of the target after the copy.
Of course, a portablility wrapper will be needed.

- Hari
Raja R Harinath ------------------------------ harinath cs umn edu
"When all else fails, read the instructions."      -- Cahn's Axiom
"Our policy is, when in doubt, do the right thing."   -- Roy L Ash

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]