unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Chris McMahan <first_initiallastname@one.dot.net>
Subject: Re: indent-region for long Java strings very slow
Date: Thu, 26 Oct 2006 13:43:16 -0400	[thread overview]
Message-ID: <umz7jvuq3.fsf@HY56D61.pg.com> (raw)
In-Reply-To: mailman.268.1161875351.27805.help-gnu-emacs@gnu.org

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 the java
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 concatenated strings,
as Java does construct a separate string object for each
concatenation. StringBuffer, as suggested, would be the way to go
here.

- Chris

David Hansen <david.hansen@gmx.net> writes:

> On 26 Oct 2006 07:15:17 -0700 "giethomas@gmail.com" <giethomas@gmail.com> wrote:
>
>> When I build a very long Java String with lots of components (... + ...
>> + ... +), spread out over many lines (each terminated by a newline),
>> indent-region gets very, very slow.
>
> Not emacs related:  AFAIK javac creates a new StringBuffer
> object for *each* `+'.  So if you don't want your program to
> be unnecessarily slow do something like
>
> String foo = (new StringBuffer ()).append (...)
>   .append (...)
>   .append (...)
>   // ...
>   .toString ();
>
> David
>
>
>

-- 
     (.   .)
  =ooO=(_)=Ooo=====================================
  Chris McMahan | first_initiallastname@one.dot.net
  =================================================

  parent reply	other threads:[~2006-10-26 17:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-26 14:15 indent-region for long Java strings very slow giethomas
2006-10-26 15:06 ` David Hansen
     [not found] ` <mailman.268.1161875351.27805.help-gnu-emacs@gnu.org>
2006-10-26 17:43   ` Chris McMahan [this message]
2006-10-26 19:21     ` David Hansen
2006-10-27  6:56     ` giethomas
2006-10-26 23:12 ` Ilya Zakharevich
2006-11-18 20:31   ` David Combs
2006-11-19  7:55     ` Ilya Zakharevich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=umz7jvuq3.fsf@HY56D61.pg.com \
    --to=first_initiallastname@one.dot.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).