This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Does interning a String improve performance?  RSS feed

 
Alok Pota
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does interning a String improve performance in dealing with Strings?
 
karl koch
Ranch Hand
Posts: 388
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
what is interning a string ?
anyway: since Strings are immutable perhaps the use of StringBuffer could help you ?
karl
 
Yuri Gadow
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A two minute hack would seem to give anecdotal evidence that operations on intern'ed string are marginally faster, but that the inclusion of the intern call itself pushes your time back out to the original (in a small op set). What effect there is on memory I don't know. I would be interested to know what the HotSpot people have to say, or if anyone has a larger test case than I had time to put together...
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!