This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: bug in PrettyWriter
- To: Felix S Klock II <pnkfelix at MIT dot EDU>
- Subject: Re: bug in PrettyWriter
- From: Per Bothner <per at bothner dot com>
- Date: 18 Aug 2001 16:16:13 -0700
- Cc: kawa at sources dot redhat dot com
- References: <200108182210.SAA15794@crash-test-felix.lcs.mit.edu>
Felix S Klock II <pnkfelix@MIT.EDU> writes:
> > Some would say excessive and premature micro-optimization.
>
> I'll say!
Well, it does make the generated bytecode both smaller and faster
(smaller is good even if it is not performance critical), and it
doesn't clutter up the source significantly.
> If this really is a performance critical loop,
I didn't say that ... It is just a habit (idiosyncrasy) of mine,
in that I tend to write things as efficiently as I conveniently can.
Sometimes that habit may make my code be a little harder to read,
but that's just the way I am.
> perhaps you should
> preallocate a static char array of ' ' elements, and then use a call
> to System.arraycopy(..) [with multiple calls for large prefix arrays].
> That would be much faster than what you have here, at a pretty minimal
> cost in space, though the logic would be quite a bit hairier.
Well, that complicates the code *and* take up more memory (code and
data), so it is harder to justify.
--
--Per Bothner
per@bothner.com http://www.bothner.com/per/