-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement
Milestone
Description
Spenson Shih opened SPR-11388 and commented
Starting in spring 4.0, evaluating SpEL expressions with map access has suffered severe performance degradation.
The code snippet below is used to demonstrate:
Map<String, String> map = new HashMap<String, String>();
map.put("key", "value");
EvaluationContext context = new StandardEvaluationContext(map);
ExpressionParser spelExpressionParser = new SpelExpressionParser();
Expression expr = spelExpressionParser.parseExpression("#root['key']");
StopWatch s = new StopWatch();
s.start();
for (int i = 0; i < 10000; i++) {
expr.getValue(context);
}
s.stop();
System.out.println(s.getTotalTimeMillis());
Using Spring 3.x, average time is 50ms. Upon upgrade to Spring 4.0, average time is 1000ms. Spring 4.0.1 is slightly better at 700ms.
Affects: 4.0 GA, 4.0.1
Referenced from: commits 7efd54e
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement