mirror of
https://github.com/MariaDB/server.git
synced 2025-07-05 12:42:17 +03:00
Backporting WL#3759 Optimize identifier conversion in client-server protocol
This patch provides performance improvements: - send_fields() when character_set_results = latin1 is now about twice faster for column/table/database names, consisting on ASCII characters. Changes: - Protocol doesn't use "convert" temporary buffer anymore, and converts strings directly to "packet". - General conversion optimization: quick conversion of ASCII strings was added. modified files: include/m_ctype.h - Adding a new flag. - Adding a new function prototype libmysqld/lib_sql.cc - Adding quick conversion method for embedded library: conversion is now done directly to result buffer, without using a temporary buffer. mysys/charset.c - Mark all dynamic ucs2 character sets as non-ASCII - Mark some dymamic 7bit and 8bit charsets as non-ASCII (for example swe7 is not fully ASCII compatible). sql/protocol.cc - Adding quick method to convert a string directly into protocol buffer, without using a temporary buffer. sql/protocol.h - Adding a new method prototype sql/sql_string.cc Optimization for conversion between two ASCII-compatible charsets: - quickly convert ASCII strings, switch to mc_wc->wc_mb method only when a non-ASCII character is met. - copy four ASCII characters at once on i386 strings/conf_to_src.c - Marking non-ASCII character sets with a flag. strings/ctype-extra.c - Regenerating ctype-extra.c by running "conf_to_src". strings/ctype-uca.c - Marking UCS2 character set as non-ASCII. strings/ctype-ucs2.c - Marking UCS2 character set as non-ASCII. strings/ctype.c - A new function to detect if a 7bit or 8bit character set is ascii compatible.
This commit is contained in:
@ -1175,3 +1175,27 @@ int vprint_msg_to_log(enum loglevel level __attribute__((unused)),
|
||||
mysql_server_last_errno= CR_UNKNOWN_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bool Protocol::net_store_data(const uchar *from, size_t length,
|
||||
CHARSET_INFO *from_cs, CHARSET_INFO *to_cs)
|
||||
{
|
||||
uint conv_length= to_cs->mbmaxlen * length / from_cs->mbminlen;
|
||||
uint dummy_error;
|
||||
char *field_buf;
|
||||
if (!thd->mysql) // bootstrap file handling
|
||||
return false;
|
||||
|
||||
if (!(field_buf= (char*) alloc_root(alloc, conv_length + sizeof(uint) + 1)))
|
||||
return true;
|
||||
*next_field= field_buf + sizeof(uint);
|
||||
length= copy_and_convert(*next_field, conv_length, to_cs,
|
||||
(const char*) from, length, from_cs, &dummy_error);
|
||||
*(uint *) field_buf= length;
|
||||
(*next_field)[length]= 0;
|
||||
if (next_mysql_field->max_length < length)
|
||||
next_mysql_field->max_length= length;
|
||||
++next_field;
|
||||
++next_mysql_field;
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user