Re: [OT] Premature optimizations
Re: [OT] Premature optimizations
- Subject: Re: [OT] Premature optimizations
- From: Chris Hanson <email@hidden>
- Date: Thu, 29 Jul 2004 19:46:50 -0700
On Jul 29, 2004, at 7:01 PM, m wrote:
Of course, no one is saying you should program like a moron. By all
means, use the appropriate data structures and algorithms for the task
at hand.
Some of us do definitely have different ideas about what the
"appropriate" data structures and algorithms are for any particular
task. For example, in generally I think the appropriate data
structures and algorithms for a task are the ones that let me do the
task in the most straightforward possible fashion, with the minimum
possible amount of duplication.
Most of the time when you're first writing some code you probably don't
need to worry about what kind of ordered collection you need to use,
just that you need to use one. You don't need to worry about what type
of sort you need to use, just that you need to use one. And so on. If
optimizing those will actually *deliver value* then the optimization is
worth spending time on as a separate task.
Just about the only case I can think of to optimize everything in
advance is when it will *only* deliver value if fully optimized. And
even then, I suspect that doing targeted profiling-based whole-system
optimization rather than full local optimization will deliver the most
value.
One of my issues with the C++ STL is that it doesn't actually implement
ordered collections in a way where different types of collections are
substitutable. In other words, you can't replace an arbitrary
std::list with a std::vector or vice versa because they don't support
the same set of operations. (Such as operator[] on std::list.) The
point of this, I gather, was to force developers to think about
performance impact of data structure and algorithm choice up front...
-- Chris
--
Chris Hanson <email@hidden>
http://www.livejournal.com/users/chanson/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.