[
https://issues.apache.org/jira/browse/VELOCITY-731?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12745234#action_12745234
]
Jörgen Rydenius commented on VELOCITY-731:
------------------------------------------
I guess it is possible circumvent the slowdown by rewriting all velocity 1.5
code and/or java code. But it seems like a huge price to pay just because some
tools generate objects with strange toString() return values. Our customers
frequently use #if to check if something exists and act accordingly. It does
not mean that the exact condition itself is going to be rendered later on.
We tried to upgrade from 1.5 to 1.6.2 to gain performance and get rid of a few
synchronization bottlenecks that troubled us. What we actually got was more
than 100% worse performance. After patching the 1.6.2 jar with r686428 backed
out, things turned to the better again, and after this we have a 20-30%
performance improval over 1.5. So all the toString() calls had a huge impact
for us. Lots of velocity code with conditions, in combination with some rather
slow toString() implementaions on large objects. But toString() was never to be
called on these objects during rendering, it was written to textually represent
the object in a humanly readable way. Just like the java API for
java.lang.Object says it should.
I agree with the general intention of VELOCITY-531 and like consistent
behaviour. I just wish that toString() wouldn't be called simply just for null
checks. That is unnecessary, because toString() should never return null. All
the java objects in the world are now paying the performance price for those
tool generated objects with null returning toString() implementations you
talked about.
Nobody else noticed this issue while upgraing from 1.5 to 1.6?
> Velocity 1.6 performance is degraded by introduced toString() calls
> -------------------------------------------------------------------
>
> Key: VELOCITY-731
> URL: https://issues.apache.org/jira/browse/VELOCITY-731
> Project: Velocity
> Issue Type: Bug
> Components: Engine
> Affects Versions: 1.6
> Environment: Apache Velocity 1.6.2
> Reporter: Jörgen Rydenius
>
> As part of VELOCITY-531, r686428 introduced frequent calls to toString() just
> to check if toString() != null. If toString() implementations are slightly
> complex, and very frequently executed, these calls will degrade the site
> performance. Are they at all necessary? What kind of object would use null as
> a return value for toString()? Is it possible to remove these toString()
> calls from the velocity code again?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]