Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Mar 2005 18:46:27 -0500 (EST)
From:      Andre Guibert de Bruet <andy@siliconlandmark.com>
To:        Peter Jeremy <PeterJeremy@optushome.com.au>
Cc:        Jeremie Le Hen <jeremie@le-hen.org>
Subject:   Re: strcspn(3) complexity improvement
Message-ID:  <20050331183010.X52981@lexi.siliconlandmark.com>
In-Reply-To: <20050331112549.GI71384@cirb503493.alcatel.com.au>
References:  <20050330083435.GI75546@obiwan.tataz.chchile.org> <20050330183145.GB24465@odin.ac.hmc.edu> <20050331112549.GI71384@cirb503493.alcatel.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help

On Thu, 31 Mar 2005, Peter Jeremy wrote:

> On Wed, 2005-Mar-30 10:31:45 -0800, Brooks Davis wrote:
>> The real question I have is, how long does the string need to be before
>> this is a win and how much does it hurt for typical string lengths?
>> I've written code with strcspn that needed to perform well, but it was
>> parsing 80-column punch card derived formats.
>
> I was thinking about this last night.  The easy way is to generate random
> "string" and "charset" arrays of varying length and time both strcspn()
> variants - this gives you two two-dimensional surfaces showing timing
> vs argument size.  The difficulty is visualising the result and
> deciding whether pairs of random strings are realistic.

I would be tempted to use list traffic as the haystack and random words of 
differing lengths from the aspell dict for the needle.

Andy

| Andre Guibert de Bruet | Enterprise Software Consultant >
| Silicon Landmark, LLC. | http://siliconlandmark.com/    >



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050331183010.X52981>