Keyword's intern(Symbol) method uses recursive invocation to get a valid keyword instance.I think it can be rewrite into a 'for loop'
to reduce method invocation cost.
So i developed this patch, and make some simple benchmark.Run the following command line three times after 'ant jar':
java -Xms64m -Xmx64m -cp test:clojure.jar clojure.main -e "(time (dotimes (link: n 10000000) (keyword (str n))))"
Before patched:
"Elapsed time: 27343.827 msecs"
"Elapsed time: 26172.653 msecs"
"Elapsed time: 25673.764 msecs"
After patched:
"Elapsed time: 24884.142 msecs"
"Elapsed time: 23933.423 msecs"
"Elapsed time: 25382.783 msecs"
It looks the patch make keyword's intern a little more fast.
The patch is attached and test.
Thanks.
P.S. I've signed the contributor agreement, and my email is killme2008@gmail.com .