Skip to content

Improve performance of StringUtils.capitalize() [SPR-15094] #19661

Closed
@spring-projects-issues

Description

@spring-projects-issues

Christoph Dreis opened SPR-15094 and commented

Hey,

just noticed a small possible improvement for (un-)capitalizing Strings. Using substring is rather expensive and we could avoid that. Please find my proposal attached.

|Benchmark|Mode|Cnt|Score|Error|Units|
|:---|
|MyBenchmark.testNew|thrpt|20|24027358,674|± 519677,096|ops/s|
|MyBenchmark.testOld|thrpt|20|16391178,671|± 378698,464|ops/s|

If no work has to be done I saw possible improvements of factor 20.

Cheers,
Christoph


Affects: 4.3.5

Referenced from: pull request #1285, and commits 31f7860, 83929b2, 5982f73

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions