Globaly improve performance (CONJ-291)

[CONJ-302] Improve String parameter decoding Created: 2016-05-25  Updated: 2019-08-02  Resolved: 2016-05-25

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: None
Fix Version/s: 1.5.0-RC

Type: Sub-Task Priority: Major
Reporter: Diego Dupin Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None


 Description   

String parameters send with text protocol use a lot of array to be send to server.
actual :

  • String.getByte("UTF-8") = String transformation to UTF-8 (= creation of an array with size 3*string length, transform char array to this byte. Copy to an array of the definitive size,
  • loop every byte to escape ' char or ',\," caracters according to escape mode.
  • send to ouput

decoding string to UTF-8 to a an array with size 3*string length (escape chars are ASCII, so escape char are 1 byte) with direct escape. When definitive size is known, write directly to output



 Comments   
Comment by Diego Dupin [ 2016-05-25 ]

JMH benchmark results :
Benchmark Mode Cnt Score Error Units
TestPerf.testActualBackSlashEscape avgt 50 5.695 ± 0.216 us/op
TestPerf.testActualnoBackSlashEscape avgt 50 5.795 ± 0.256 us/op
TestPerf.testNewBackSlashEscape avgt 50 0.996 ± 0.493 us/op
TestPerf.testNewNoBackSlashEscape avgt 50 1.667 ± 0.248 us/op

Generated at Thu Feb 08 03:14:40 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.