home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c      Meh, in C you gotta define EVERYTHING      243,242 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 242,030 of 243,242   
   Michael Sanders to bart   
   Re: strspn()   
   22 Nov 25 00:56:06   
   
   From: porkchop@invalid.foo   
      
   On Sat, 22 Nov 2025 00:04:24 +0000, bart wrote:   
      
   > Performance probably isn't critical in your use-case, but the solution   
   > using 'strspn' was three times as slow as doing the explicit code.   
   >   
   > (Test string was a fixed "8725" and tested 100M times.)   
   >   
   > This is not surprising since strspn doesn't know that the substring is   
   > ordered so doesn't need to test every character of the input string   
   > against every every character of the substring, at least while there is   
   > a match.   
      
   I don't doubt it bart. Where as my loop was custom built for that particular   
   condition, strspn() has to be alot more generic & thus slower. But still its   
   a nifty function in concept no?   
      
   --   
   :wq   
   Mike Sanders   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca