• Post Reply Bookmark Topic Watch Topic
  • New Topic

Does interning a String improve performance?

 
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...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!