On 12/1/05, saf <saf@stripped> wrote:
> Hi,
>
> I'm developper at the NOOFS project (filesystem which saves its data in a SQL database).
> I needed more speed for the function escape_string_for_mysql(...), so I changed the source code.
>
> My local benchmark tests results was that this function is now two times faster (without multi-byte
> characters) than before. I couldn't test it with multi-byte characters, if somebody at MySQL
> could do it, it would be nice. "Normally" it should work with the two.
>
> I know that this new code is "ugly", but there was no other choice to have more speed. It's possible to
> make a beautifuller code, but the function will loss speed.
If you replace the continue by else, does that still result in a loss of speed?
Can you assume ASCII order for the characters you check?
If so, you could do a binary search to reduce the number of checks.