Github user carsonwang commented on the pull request:
https://github.com/apache/spark/pull/11090#issuecomment-180652254
Reusing a `Calendar` object when the method will be called frequently is
something recommended by "Effective Java" mentioned
[here](http://www.informit.com/articles/article.aspx?p=1216151&seqNum=5). The
more the method is invoked, the more performance improvement we get.
`stringToTimestamp` has the same problem but it uses different `TimeZone`s
instead of only a GMT `TimeZone`. We need cache the `TimeZone`s in a hash map
as I did in #11071. It is a little more involved and there is a case that the
`Calendar` cannot be reused. So I'll keep it as is and make this PR as small as
possible for now. If it is worth doing, I'll be happy to submit a new PR to
address it.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]