Re: Questions from a Beginner.
- Posted by mattlewis (admin) May 16, 2009
- 1315 views
Since the relevant parts have been snipped from this part of the subthread, I'll provide a short summary for future readers of this post. Critic attempted to demonstrate a flaw in Euphoria by modifying a stack implementation written in Euphoria (which was written in response to another claim made by Critic). When told that his example was actually faster (thus doing the very opposite of demonstrating the flaw), he jumped to another unrelated issue that was discovered and reported on the same thread. This unrelated issue was since fixed. So, the first time the O(n) claim was made, it was shown to be false. The second time the claim was made, it was valid at the time, but no longer is.
I also note that this is not the first time Critic has accused a developer of lying.
To be fair, there are instances where euphoria does things in O(n) where other languages might do them in O(1). 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.
For instance, one trade off is that all euphoria variables are passed by value, though copies are only made when data is written (copy on write) to something with more than one reference. The trade off here is pass by reference semantics, which are often more efficient, but are more complicated to code and maintain.
Just because some algorithm has a bigger big-O does not necessarily make it a worse choice. For most common cases, it's probably very difficult to tell the difference between two very different algorithms. The speed of most of a program often doesn't matter. If the slower algorithm is easier to code and maintain, it might very well make a better general purpose solution.
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. 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. And the social skills of a thermonuclear bomb, as Raymond Chen might say.
Matt