• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to intialize large String content in string literal?

 
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I had a large string content which consists of more than 10 thousand words, hence each time i called the respective java the string gets initialized,so it hits performance,is there any way to improve performance?
 
Ranch Hand
Posts: 375
1
Python Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

santhosh.R gowda wrote:Hi,
I had a large string content which consists of more than 10 thousand words, hence each time i called the respective java the string gets initialized,so it hits performance,is there any way to improve performance?



Is that string fixed all over your application or you are supposed to modify it??
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

santhosh.R gowda wrote:I had a large string content which consists of more than 10 thousand words


The term "large string content" covers a multitude of sins. Where does it come from? A file? A database? If a file, is that file arranged in lines? All these things will have an effect on how you proceed.

Second: Don't obsess about efficiency, either for space or speed. Get it right. Tweaks for efficiency can always come later, and 10,000 words is 150K or so - peanuts for most modern machines. If it were 10 million words, you might have cause for worry, but even then my advice would be the same: get it right first.

Winston
 
Marshal
Posts: 79036
375
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

santhosh.R gowda wrote: . . . each time i called the respective java the string gets initialized, . . .

I don’t understand that bit. Do you mean the String is initialised every time you start the JVM? Does it actually have more than one initialisation per execution?
 
reply
    Bookmark Topic Watch Topic
  • New Topic