[CONJ-1010] improve TEXT parameter substitution Created: 2022-09-07  Updated: 2022-09-07  Resolved: 2022-09-07

Status: Closed
Project: MariaDB Connector/J
Component/s: performance
Affects Version/s: None
Fix Version/s: 3.0.8

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


 Description   

Actual client side prepared statement parse query to detect question mark parameters in query.
This parsing use String.toCharArray(). Since java 9 and String compaction that can have internal representation in latin1 or utf-16, this now required calculation to get char array.
A better solution is to get utf8 byte representation of commands and simply parse parameters indexes. This will avoids toCharArray and substring use.



 Comments   
Comment by Diego Dupin [ 2022-09-07 ]

benchmark results for query "do ?,?, ...., ?,?" with 1000 parameters

before implementation

Benchmark            (driver)   Mode  Cnt     Score    Error  Units
Do_1000_params.text   mariadb  thrpt   50  3831.947 ± 47.636  ops/s

After improvement:

Benchmark            (driver)   Mode  Cnt     Score    Error  Units
Do_1000_params.text   mariadb  thrpt   50  4194.093 ± 44.340  ops/s

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