01.09.2013, 13:51
Quote:
Is it possible to speed up mysql_real_escape_string?
It takes 193ms for me for about 600 length string. I'm using R30. |
Quote:
I think I see a potential problem with the code in CScripting.cpp.
The memory allocated for the output of the C mysql_real_escape_string must be (2*strlen(input))+1. Assuming that you usually know what you're doing, when you write PAWN code, you do this: pawn Код:
pawn Код:
I assume this is not going to make a relevant speed difference, and perhaps the AMX interactions with large arrays is just slow, but using heap allocation (alloca instead of malloc) is a possibility here as well. Once again may not make a relevant speed difference, and may even be dangerous (if you start allocating megabytes!) |
Yes, it looks like the library's mysql_real_escape_string appends a NULL-byte, didn't saw that. This indeed saves me the use of memset, thanks for pointing that out.
Quote:
Originally Posted by AndreT
I assume this is not going to make a relevant speed difference, and perhaps the AMX interactions with large arrays is just slow, but using heap allocation (alloca instead of malloc) is a possibility here as well.
|
I completely rewrote mysql_format in R28 and tested it on Linux, I doubt that there are any problems now.