help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: indent-region for long Java strings very slow


From: address@hidden
Subject: Re: indent-region for long Java strings very slow
Date: 26 Oct 2006 23:56:01 -0700
User-agent: G2/1.0

I agree about the inefficiency of building a string with a series of
concatenated strings. but this leaves the emacs issue of parsing the
string sequence when indenting the java source code.

The problem gets worse and worse with longer source files, even though
I only run indent-region.

On Oct 26, 7:43 pm, Chris McMahan <first_initiallastn...@one.dot.net>
wrote:
> I think the issue is not the running time of the program, but the time
> it takes emacs to parse the string sequence when indenting thejava
> source code. In that case, it is an emacs issue.
>
> I would agree, however, with David's assessment that it's extremely
> inefficient to build a string with the series of concatenatedstrings,
> asJavadoes construct a separate string object for each
> concatenation. StringBuffer, as suggested, would be the way to go
> here.
>
> - Chris
>
>
>
> David Hansen <david.han...@gmx.net> writes:
> > On 26 Oct 2006 07:15:17 -0700 "gietho...@gmail.com" <gietho...@gmail.com> 
> > wrote:
>
> >> When I build averylongJavaString with lots of components (... + ...
> >> + ... +), spread out over many lines (each terminated by a newline),
> >>indent-regiongetsvery,veryslow.
>
> > Not emacs related:  AFAIK javac creates a new StringBuffer
> > object for *each* `+'.  So if you don't want your program to
> > be unnecessarilyslowdo something like
>
> > String foo = (new StringBuffer ()).append (...)
> >   .append (...)
> >   .append (...)
> >   // ...
> >   .toString ();
>
> > David--
>      (.   .)
>   =ooO=(_)=Ooo=====================================
>   Chris McMahan | first_initiallastn...@one.dot.net
>   =================================================



reply via email to

[Prev in Thread] Current Thread [Next in Thread]