Re: Questions from a Beginner.
- Posted by mattlewis (admin) May 17, 2009
- 1380 views
In particular, where we might have to ref or deref a sequence to assign to one of its elements. However, comparing big-O notation isn't always the complete story. The complete story involves the trade offs to which I alluded.
An algorithm which requires O(n) instead of O(1) is crap and will break you neck soon enough. Always. Why do you think Quicksort has been invented? Because sorting in O(n^2) sucks big time, no matter how many micro-optimizations you implement. This has nothing to do with premature optimization.
But you've still left out a key fact, which is that the big-O notation doesn't tell us everything about an algorithm. You still need to consider the size of n and the coefficient. This is what actually profiling your code does for you.
Of course, you're correct that in general quicksort will beat, say, bubble sort. But in the context of an application, that's merely a micro-optimization. And maybe not the most important one. If you only ever sort 3 or 4 items at a time, you're probably not losing a whole lot using a bubble sort. Please, tell me why I'm wrong and/or lying. I can't wait.
There are work arounds for this in euphoria (Derek showed one in a previous thread). Most code won't need it, in part because euphoria can be very fast in other ways, at least compared to other interpreted languages.
"Very fast in other ways" does not help, especially since it is only "very fast" for micro benchmarks. Biggest bang comes from algorithmic optimizations. This is a well known fact.
Yes, it is. But in order to get those algorithmic optimizations, you first have to know which part of your algorithm is causing the slow down. This is the very crux of premature optimization.
Intellectual masturbation regarding computing theory is all well and good, but the sort that Critic has been talking about is really just another example of premature optimization.
O(n) vs. O(1) is not an example of premature optimization. That's ridiculous. Again you try to argue about things you don't know about or you consiously misrepresent the issue to defend EU.
In fact, that's the very definition of premature optimization. You're arguing that you should never ever do anything O(n) when O(1) is available somewhere, somehow. If the O(n) algorithm isn't hurting your performance, but is easier to use and maintain, why would you change it?
In some cases, it might even be faster. Consider a case where your O(1) algorithm has a coefficient of 25, and the O(n) of 2. In this case, the O(n) algorithm is faster until n = 13. Your misuse of big-O notation has just slowed you down if your n is always smaller than 13.
And the social skills of a thermonuclear bomb, as Raymond Chen might say.
So what? Your argumentation skills consist of spreading FUD, so maybe you should mind you own business.
Oh, please. You come here, call me a liar, call me incompetent, and I'm the one who should mind his own business? I've agreed with you that in certain places you've had good points. In some cases, I've mentioned that your very points were things that we wanted to look at. In other places, I've explained why some of those things aren't likely to change.
If anyone is spreading FUD around here, it's you. Yes, I've defended euphoria in some cases. But I certainly don't have a hidden agenda, which you seem to. At least, that's what your behavior suggests to me. Here's how wikipedia defines FUD:
Fear, Uncertainty, and Doubt (FUD) is a tactic of rhetoric and fallacy used in sales, marketing, public relations,[1][2] politics and propaganda. FUD is generally a strategic attempt to influence public perception by disseminating negative information designed to undermine the credibility of their beliefs. An individual firm, for example, might use FUD to invite unfavorable opinions and speculation about a competitor's product; to increase the general estimation of switching costs among current customers; or to maintain leverage over a current business partner who could potentially become a rival. FUD techniques may be crude and simple. Alternatively they may be very subtle, employing an indirect approach.
The term originated to describe disinformation tactics in the computer hardware industry and has since been used more broadly.[3] FUD is a manifestation of the appeal to fear.
Wow, if you were pushing some other programming language, that definition would be a great description of how you've acted on this forum. Since you brought up the FUD angle, and the shoe seems to fit, are you pushing some other programming language.
Matt