[Advanced-java] Coding String.indexOf() with ignore quoted

Nikolaos Giannopoulos nikolaos at solmar.ca
Sun Apr 13 14:46:20 2003


> -----Original Message-----
> From: advanced-java-bounces@lists.xcf.berkeley.edu
> [mailto:advanced-java-bounces@lists.xcf.berkeley.edu]On Behalf Of Steven
> J. Owens
>
>
>      It's because, to quote Knuth, "Early optimization is the root of
> all evil."  <snip>

Yes, but isn't this is an Advanced Java forum?  Honestly, I'm not about to
ask a question of this nature if I don't have good reason to ask - I'm sure
others do and that may cause confusion - but the majority of those posts are
one time posts from new users.

Moreover, the blanket "don't worry, just optimize where you need it later",
does nothing to advance solving the problem at hand.  Honestly I'd rather
someone not reply than give me the 'Optimize it later line' as *anyone* that
frequents this mailing list should clearly understand this fact.


>      Given that, and the prevalence of developers with misdirected
> optimizing behavior, it's not surprising that this meme keeps getting
> brought up when you don't explain what you're doing and why it makes
> sense to devote any degree of time energy to spot-optimizing this bit
> of code.

Agreed.  I should have mentioned from the start that this was framework code
and that is definately my fault.  On the other hand, I could still see
someone throwing the 'optimize it later line' as one could suggest simply
profile each app and you may have no need to touch the implementation of
this framework method.


>      Framework code is one of the classic exceptions usually mentioned
> in screeds about when not to optimize and when to optimize.  If you'd
> mentioned that this was framework code earlier in the conversation (or
> did I miss that?  I might have) I suspect you wouldn't have had the
> opportunity to rant.

Once again I agree.  Obviously I didn't clearly convey this fact in my
initial post and will do so in the future and we'll see if I still 'get an
optimize it later line' ;-)


>      Another exception is if you're just looking for faster ways to do
> it for fun and education, of course.

Not the case.  And I definitely would have mentioned that before hand.

Thanks for clarifying the need for the up front "framework remark".

--Nikolaos