Re: [OT] was: Where is NSList? (All Threads)
Re: [OT] was: Where is NSList? (All Threads)
- Subject: Re: [OT] was: Where is NSList? (All Threads)
- From: Steve Checkoway <email@hidden>
- Date: Fri, 30 Jul 2004 03:10:32 -0700
On Jul 30, 2004, at 1:33 AM, Keith J.Schultz wrote:
I think you should all go back to school and take a software
engineering course.
Your statements are correct to a single respect which you point out.
Examine my e-mail address.
A very good programmer will first:
1) analyse his data structures and required methods (procedures)
2) available languages and resources
3) intended distribution (effects choices in 2)
4) time table for development
I agree.
OO-programming languages are neat and make development quick and
easy, yet it
comes with perfomance hits !! It has many times been mentioned here
about the
efficiency of different algorithms, but you have missed out one how
the objects
are implemented in Cocoa. You have discussed how one can make
programs more efficient
The point of discussing the algorithms rather than the implementations
is that implementations may vary and not have any substantial effect on
the algorithm's efficiency.
you you start with this and then make it better by that, but a good
programmer will have
actually considered the the best method a head of time. S/he should
only need to reconsider
if the specifictions change.
As was pointed out before, this is simply not the case. Here's the
quote:
"If the development time saved by implementing the simplest program is
devoted to optimizing the running program, the result will *always* be
a faster running program than the one in which optimization efforts
have been exerted indiscriminantly(sic) as the program was developed."
Also, specifications change all the time. To imagine that this happens
one once in a while is naive.
As a rule if you need something to be efficient code it you self !
What are you talking about? Lets say that I wanted to write a parser
for a programming language. With what I know right now, I could fairly
easily construct a recursive decent parser for an LL(1) grammar (after
factoring the common prefixes and removing all left recursion). That
said, I could (for far less work) get a much more efficient parser by
writing a few lines of yacc (bison) code and get a much more powerful
LALR parser that is far more efficient than mine would be.
An example:
a matrix(array) where a[i,j] = a[j,i]
a new matrix had be calcuted by a very complicated formula where
rows and columns mutiplied
and diffent sums where used.
--> you can reduce the size of the matrix by considering to be
diagonal, by a factor of roughly 2
--> now with working knowlege of C and how C accesses arrays one
could simply use nested loops
and do the calcutions. But there is a faster way the basic
algorithm is the same but instead
of use arrays, one could access the values via pointers. The
effect is dramatic. The program
ran a 1000 times faster. This optimaztion of an programme which
was programmed straight forward
was done by analysis of the problem not the program.
I'm not entirely sure what you mean here. An array reference is nothing
more than adding the base address of the array to the offset times the
size of the data and then loading from that location in memory.
Dereferencing a pointer means loading from that value. So what have you
saved? An add and a multiply (or more likely an arithmetic right shift
in the common case where the size of the data is a word, or any
multiple of two for that matter). Given what you've told us, you've
gone from a load to an add, a shift and a load so you should get a 3x
boost in performance (assuming that you can load in a single cycle).
1000 times faster?
My advice is there think first code later.
I think I agree with you here
Good programming is:
20 % analysis and planning
10 % coding
60 % documentation
I think I'd say that they are all about the same. I strongly disagree
that 10% is coding. But then, that is only a matter of opinion.
- Steve
_______________________________________________
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.