Re: Questions from a Beginner.
- Posted by DerekParnell (admin) May 17, 2009
- 1274 views
To be fair, there are instances where euphoria does things in O(n) where other languages might do them in O(1).
Yes. Exactly.
So you agree that Euphoria currently does some things slower than the perfect possible implementation. Wow! Its a good thing that no other language's implementation is the same - which which means that every C implementation runs at the same speed.
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.
Not only FUD but an out of context reply - well done kid. An extra elephant stamp for you this week.
By the way, what is the O(1) algorithm for calculating Prime Numbers? Or the O(1) sort?
Ok, here's an easier one... given two sets of numbers - A and B, what is the difference between each number in set A and each number if set B?
eg.
A = {1,2,13} B = {5,9,18} Difference set is {-4, -8, -17, -3, -7, -16, 8, 4, -5}
Is there an O(1) algorithm? Is there even an O(n) algorithm?
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.
You do have proof for the "only 'very fast' for micro benchmark" comment don't you?
Biggest bang comes from algorithmic optimizations. This is a well known fact.
Yep. But that is not what anyone here is talking about - another diversionary tactic to sow Fear, Uncertainty and Doubt.
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.
You are really struggling to understand what's being discussed aren't you.
You have given one single example of where Euphoria is slower than it needs to be, and we have shown you that this is only due to sub-optimal optimisation by the interpreter, and that there is a workaround anyway. And by "premature optimisation", Matt is saying that spending a lot of resources on making this situation run faster will not necessarily make the application run any faster. Your comment re "algorithmic optimizations" is a better target for effort than sequence element access algorithms.
By the way, future editions of Euphoria will be improving in this area anyway.
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.
This is Matt's business, boy. You are the real FUD spreader.
Don't be discouraged though. Keep trying to keep up. Start by helping us rather than shovelling manure.