Bug #103790 Contribution: Backport Bug#28949700: SUBOPTIMAL USE OF STRING::RESERVE() IN ...
Submitted: 24 May 2021 14:01 Modified: 8 Jun 2021 22:07
Reporter: OCA Admin (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: JSON Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[24 May 2021 14:01] OCA Admin
Description:
This bug tracks a contribution by Annirudh Prasad (Github user: annirudh) as described in http://github.com/mysql/mysql-server/pull/336

How to repeat:
See description

Suggested fix:
See contribution code attached
[24 May 2021 14:01] OCA Admin
Contribution submitted via Github - Backport Bug#28949700: SUBOPTIMAL USE OF STRING::RESERVE() IN WRAPPER_TO_STRING( 
(*) Contribution by Annirudh Prasad (Github annirudh, mysql-server/pull/336#issuecomment-846109878): I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: git_patch_646089810.txt (text/plain), 6.23 KiB.

[24 May 2021 14:30] MySQL Verification Team
Thank you for the contribution.
[8 Jun 2021 22:07] Jon Stephens
Documented fix as follows in the MySQL 5.7.36 changelog:

    Conversion of JSON values to text caused linear growth of the
    destination string, resulting in an unnecessarily high number of
    reallocations. Now this process uses exponential growth instead,
    to reduce the number of allocations required.

    This fix originally appeared in MySQL 8.0 and was backported to
    MySQL 5.7 by Annirudh Prasad, whom we thank for the
    contribution.

Closed.