- From: Adrien W. de Croy <adrien@qbik.com>
- Date: Sat, 09 Feb 2013 21:33:13 +0000
- To: "Willy Tarreau" <w@1wt.eu>, "Martin Nilsson" <nilsson@opera.com>
- Cc: "ietf-http-wg@w3.org" <ietf-http-wg@w3.org>
------ Original Message ------ From: "Willy Tarreau" <w@1wt.eu> >On Sat, Feb 09, 2013 at 03:12:32PM +0100, Martin Nilsson wrote: >> On Sat, 09 Feb 2013 14:33:41 +0100, Willy Tarreau <w@1wt.eu> wrote: >> >> >Also, processing it is >> >particularly inefficient as you have to parse each and every byte to >>find >> >a length, making string comparisons quite slow. >> >> You don't need to know the length in characters to compare strings. >>Just >> comparing byte on byte works fine. > >This is exactly what you want to avoid when comparing with lots of >strings. >It's generally more efficient to first compare lengths, then byte per >byte >only if lengths match. only if you don't have to count bytes to get the length. IF you need to do that, then byte-by-byte is more efficient. I guess we're talking about length-prefixed data in this context though so it would be an available optimisation. Adrien > >
Received on Saturday, 9 February 2013 21:34:16 UTC