| Author |
How to intialize large String content in string literal?
|
santhosh.R gowda
Ranch Hand
Joined: Apr 06, 2009
Posts: 296
|
|
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?
|
Creativity is nothing but Breaking Rules
|
 |
R. Jain
Ranch Hand
Joined: Aug 11, 2012
Posts: 276
|
|
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??
|
OCPJP
|
 |
Winston Gutkowski
Bartender
Joined: Mar 17, 2011
Posts: 4724
|
|
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
|
Isn't it funny how there's always time and money enough to do it WRONG?
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32599
|
|
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?
|
 |
 |
|
|
subject: How to intialize large String content in string literal?
|
|
|