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

Cache results of Converter lookup in GenericConversionService to improve performance [SPR-7110] #11770

Closed
spring-projects-issues opened this issue Apr 17, 2010 · 3 comments
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Apr 17, 2010

Keith Donald opened SPR-7110 and commented

Currently every call into the ConversionService results in a fairly-involved search to match the Converter to use for a given source/target TypeDescriptor pair. Performance could likely be improved significantly by caching the results of converter lookup operations.


Affects: 3.0.2

Issue Links:

@spring-projects-issues
Copy link
Collaborator Author

Keith Donald commented

Now Caching Converter lookup results to improve conversion service performance.

@spring-projects-issues
Copy link
Collaborator Author

Keith Donald commented

Some performance benchmarks on my modest Macbook laptop:

converting 1,000,000 int to string with caching: 603 ms
converting 1,000,000 int to string without caching: 17306 ms

converting 1,000,000 list<string> (size=3) to list<int> with caching: 3599 ms
converting 1,000,000 list<string> (size =3) to list<int> without caching: 21634 ms

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Apr 19, 2010

Keith Donald commented

Latest benchmarks after additional optimizations:

StopWatch 'integer->string conversionPerformance': running time (millis) = 905


ms % Task name


00701 077% convert 4,000,000 with conversion service
00204 023% convert 4,000,000 manually

StopWatch 'list<string> -> list<integer> conversionPerformance': running time (millis) = 2029


ms % Task name


01504 074% convert 4,000,000 with conversion service
00525 026% convert 4,000,000 manually

StopWatch 'map<string, string> -> map<string, integer> conversionPerformance': running time (millis) = 3789


ms % Task name


02171 057% convert 4,000,000 with conversion service
01618 043% convert 4,000,000 manually

WITHOUT CACHING is significantly slower:

StopWatch 'integer->string conversionPerformance': running time (millis) = 36184


ms     %     Task name


35984  099%  convert 4,000,000 with conversion service
00200  001%  convert 4,000,000 manually

StopWatch 'list<string> -> list<integer> conversionPerformance': running time (millis) = 11032


ms     %     Task name


10453  095%  convert 4,000,000 with conversion service
00579  005%  convert 4,000,000 manually

StopWatch 'map<string, string> -> map<string, integer> conversionPerformance': running time (millis) = 46752


ms     %     Task name


45089  096%  convert 4,000,000 with conversion service
01663  004%  convert 4,000,000 manually

@spring-projects-issues spring-projects-issues added 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 3.0.3 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) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant