all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "giethomas@gmail.com" <giethomas@gmail.com>
Subject: Re: indent-region for long Java strings very slow
Date: 26 Oct 2006 23:56:01 -0700	[thread overview]
Message-ID: <1161932161.564077.116050@m73g2000cwd.googlegroups.com> (raw)
In-Reply-To: <umz7jvuq3.fsf@HY56D61.pg.com>

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
>   =================================================

  parent reply	other threads:[~2006-10-27  6:56 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
2006-10-26 19:21     ` David Hansen
2006-10-27  6:56     ` giethomas [this message]
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

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

  git send-email \
    --in-reply-to=1161932161.564077.116050@m73g2000cwd.googlegroups.com \
    --to=giethomas@gmail.com \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.