On Tue, Apr 05, 2005 at 08:46:50PM -0700, Matthew Dillon 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 think the answer is to not use strcspn() in cases where it *really* > matters. Certainly. strcspn() wasn't worth optimizing out after I replaced the hand coded crap that used getc to parse files up to 100MB is size and did a realloc for each character! That got me a 50% speedup in overall execution time and the function dropped from #1 to <#50 in the profiling numbers. At that point FPU intensive code was at the top where it belonged. My main point was to avoid a purely theoretical "optimization". -- Brooks -- Any statement of the form "X is the one, true Y" is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:31 UTC