<sq****@mail.ru> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
I guess most of them either:
- never heared of the 10%-90%-rule
I have to admit I didn't. So what rule is?
Your code spends 90% of it's time in 10% of the code. Is it really worth it
to make your entire development project harder in order to gain a fairly
minor speed boost, when only 10% of it really matters? Additionaly, unless
you're really pushing the hardware to the limit, improving your algorithms
will result in a far greater speed boost than changing programming language.
As an example, the project I'm on submits scanned images and their
associated data to various disparate systems. This takes up to 3 seconds on
the client machine. I can't thread the access to the various systems, since
they're interdependent. However throughput is very important. So what I've
done is kick off the submission into it's own thread, where it takes the
full 3 seconds to complete the process. In the meantime though, the user has
moved onto the next document, and is working on that, speeding their
throughput. If there is a problem with the submission, the document goes
back into the queue, along with the error information to be displayed to the
user. Basically, by a relatively simple change I've improved the perceived
lag from 3 seconds to under half a second. I could have rewritten the
submission in C++, but as I said, it's mostly just blocking calls to other
systems, so the speed improvement would have been negligible. Instead, by
concentrating on the algorithm, I've cut the lag to 8% of it's original
value, even through if you did a profile, the actual performance cost is
higher, due to context switches and suchlike.
Also, always keep in mind the difference between perceived performance and
actual performance. In the same project, I got complaints that the
application was taking too long to initialize. I tossed in a funky splash
screen, with a progress bar and all of a sudden the users are happy with the
initialization. They can see that the program is doing something, and how
far it's got, so they perceive the performance as better, even when it's
actually slightly worse. Again, I could have written the whole thing in C++,
but it would have taken twice as long to develop, and would (probably) have
all sorts of funky circular references, dangling pointers, and memory leaks.
All that for a maximum improvement of about 1 second on initialization, and
0.2 seconds on switching between documents. Not worth it in my opinion.
--
Sean Hederman
http://codingsanity.blogspot.com