Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spring-jdbc : Improve memory allocations when substituting named parameters. [SPR-16170] #20718

Closed
spring-projects-issues opened this issue Nov 7, 2017 · 2 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Benoit opened SPR-16170 and commented

Create the buffer with at least the original sql length to avoid multiple re-allocations
Add a fast path if the original sql doesn't contain any parameters

JMH results

MyBenchmark.old                                                  thrpt   50   429702,315 ±   8526,336   ops/s
MyBenchmark.oldgc.alloc.rate                                   thrpt   50     1089,447 ±     21,757  MB/sec
MyBenchmark.oldgc.alloc.rate.norm                              thrpt   50     3992,001 ±      0,001    B/op
MyBenchmark.oldgc.churn.PS_Eden_Space                          thrpt   50     1102,400 ±     29,500  MB/sec
MyBenchmark.oldgc.churn.PS_Eden_Space.norm                     thrpt   50     4039,513 ±     71,742    B/op
MyBenchmark.oldgc.churn.PS_Survivor_Space                      thrpt   50        0,180 ±      0,027  MB/sec
MyBenchmark.oldgc.churn.PS_Survivor_Space.norm                 thrpt   50        0,659 ±      0,098    B/op
MyBenchmark.oldgc.count                                        thrpt   50      783,000               counts
MyBenchmark.oldgc.time                                         thrpt   50      333,000                   ms
MyBenchmark.newVersion                                           thrpt   50   478496,476 ±   5144,476   ops/s
MyBenchmark.newVersiongc.alloc.rate                            thrpt   50     1008,926 ±     10,849  MB/sec
MyBenchmark.newVersiongc.alloc.rate.norm                       thrpt   50     3320,001 ±      0,001    B/op
MyBenchmark.newVersiongc.churn.PS_Eden_Space                   thrpt   50     1023,339 ±     21,646  MB/sec
MyBenchmark.newVersiongc.churn.PS_Eden_Space.norm              thrpt   50     3368,042 ±     68,881    B/op
MyBenchmark.newVersiongc.churn.PS_Survivor_Space               thrpt   50        0,156 ±      0,033  MB/sec
MyBenchmark.newVersiongc.churn.PS_Survivor_Space.norm          thrpt   50        0,514 ±      0,109    B/op
MyBenchmark.newVersiongc.count                                 thrpt   50      647,000               counts
MyBenchmark.newVersiongc.time                                  thrpt   50      285,000                   ms

MyBenchmark.oldNoParams                                          thrpt   50  1642986,386 ±  47483,217   ops/s
MyBenchmark.oldNoParamsgc.alloc.rate                           thrpt   50     2857,392 ±     82,456  MB/sec
MyBenchmark.oldNoParamsgc.alloc.rate.norm                      thrpt   50     2738,400 ±      3,600    B/op
MyBenchmark.oldNoParamsgc.churn.PS_Eden_Space                  thrpt   50     2893,399 ±     96,256  MB/sec
MyBenchmark.oldNoParamsgc.churn.PS_Eden_Space.norm             thrpt   50     2773,357 ±     51,150    B/op
MyBenchmark.oldNoParamsgc.churn.PS_Survivor_Space              thrpt   50        0,186 ±      0,031  MB/sec
MyBenchmark.oldNoParamsgc.churn.PS_Survivor_Space.norm         thrpt   50        0,178 ±      0,029    B/op
MyBenchmark.oldNoParamsgc.count                                thrpt   50      882,000               counts
MyBenchmark.oldNoParamsgc.time                                 thrpt   50      382,000                   ms
MyBenchmark.newVersionNoParams                                   thrpt   50  2355892,983 ± 107644,968   ops/s
MyBenchmark.newVersionNoParamsgc.alloc.rate                    thrpt   50     2178,567 ±     99,614  MB/sec
MyBenchmark.newVersionNoParamsgc.alloc.rate.norm               thrpt   50     1456,000 ±      0,001    B/op
MyBenchmark.newVersionNoParamsgc.churn.PS_Eden_Space           thrpt   50     2186,719 ±    112,842  MB/sec
MyBenchmark.newVersionNoParamsgc.churn.PS_Eden_Space.norm      thrpt   50     1461,406 ±     35,027    B/op
MyBenchmark.newVersionNoParamsgc.churn.PS_Survivor_Space       thrpt   50        0,179 ±      0,030  MB/sec
MyBenchmark.newVersionNoParamsgc.churn.PS_Survivor_Space.norm  thrpt   50        0,121 ±      0,022    B/op
MyBenchmark.newVersionNoParamsgc.count                         thrpt   50      907,000               counts
MyBenchmark.newVersionNoParamsgc.time                          thrpt   50      401,000                   ms

Affects: 4.3.12, 5.0.1

Referenced from: pull request #1588, and commits 457c70c

Backported to: 4.3.13

@spring-projects-issues
Copy link
Collaborator Author

Benoit commented

See #1588

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Merged into master now; I'll backport it to 4.3.x later this week.

@spring-projects-issues spring-projects-issues added status: backported An issue that has been backported to maintenance branches type: enhancement A general enhancement in: core Issues in core modules (aop, beans, core, context, expression) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 5.0.2 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants