mirror of
https://github.com/MariaDB/server.git
synced 2026-04-27 02:35:29 +02:00
Make SQLString reallocation addaptive
Avoid doing reallocs Prealloc some strings / provide extension allocation size to some strings This gave a 25 % speedup in some mysql-test-run tests. mysys/safemalloc.c: More DBUG_PRINT sql/net_serv.cc: Make all mallocs() look the similar. (just-for-safety fix) sql/protocol.cc: Ensure that communication packet buffer is allocated. (It's freed by stored precedures and some DLL statements) sql/sp.cc: Fixed valgrind warning sql/sql_select.cc: Set extent allocation for buffer that has a lot of append() calls. sql/sql_show.cc: Fixed wrong usage of string buffer. Old code worked in test suite 'just-by-chance' sql/sql_string.cc: Call realloc_with_extra_if_needed() in append() functions. sql/sql_string.h: Added 'extra_alloc' member, to specify chunck size for realloc(). extra_alloc is addaptive to catch cases where preallocation of buffers is not done properly. Simplified free() to allow compiler to optimize things better (and to keep things consistent). Fixed shrink() to take into account the extra memory added to the Alloced_length in realloc(). This saves us a realloc() per query. sql/sql_test.cc: Set extent allocation for buffer that has a lot of append() calls. sql/table.cc: Set extent allocation for buffer that has a lot of append() calls.
This commit is contained in:
parent
18292caa48
commit
7b047a31a0
10 changed files with 56 additions and 33 deletions
|
|
@ -632,6 +632,9 @@ bool Protocol::send_fields(List<Item> *list, uint flags)
|
|||
uint count= 0;
|
||||
#endif
|
||||
|
||||
/* We have to reallocate it here as a stored procedure may have reset it */
|
||||
(void) local_packet->alloc(thd->variables.net_buffer_length);
|
||||
|
||||
while ((item=it++))
|
||||
{
|
||||
char *pos;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue