Should a change in the documented performance of a method be considered a violation?

It seems like a general rule in software development is that after you have deployed a public API, especially if you have registered this API (which, yes, you must have), you should think for a long time before introducing which any changes may violate the compatibility with this API, since such changes will violate the changes. In fact, I’m sure that many developers claim that you simply shouldn’t do this at all, no matter how long and hard you can think of it.

Sometimes a developer actually documents the performance of a method. Many MSDN documents do this, for example, using Big O notation . Would this also change with a "destructive" change? Maybe this is not a clear question; in another way: should be avoided?

It seems to me that in cases where, for example, you could develop an excellent algorithm to solve the problem, if you previously registered that this algorithm was O (N 2 ), you can be forgiven to improve your API by replacing it with this excellent an algorithm that, say, O (log N). Users of your API may notice this and, I think, will only be happy to improve.

On the other hand, I wonder if it will ever be considered “justified” to degrade the performance of your API component for other reasons, for example, you optimize for the most common use case, which leads to performance degradation in general; You optimize memory on processor cycles or vice versa; you eliminate the external dependency that caused other problems, etc.

My intuition tells me that improving performance is almost always always in order. What about the opposite? Is everything all right if you update your documentation? Is this just wrong? I'm just looking for some reasonable recommendations here.

+5
4

, , , .

, , . , - , .

, , .

(: - API ), , , - , .

+1

A Breaking Change - , ... .

, , ( , , - ) , . , , , , , .

, , , .

, ( ) . , . , ?

+1

, ++ , STL , Big-O.

, (2-3 , N ~ 10 7), O (N 2) . API- O (N) O (N 2), ( 2 4000- ), . , , Big-O .

+1

, -O. O (log n), O (n ^ 2), . , , - POV ( ).

, , -. , , , , . , , : " ", :

int myfunc_omega_n_squared(n, args) {
    sleep(n*n); // well, actually in a loop because of spurious wakes
    return myfunc(n, args);
}

myfunc, ; -)

, , , (, ), - , , POV , .

, . , , - , . , O (n ^ 2), 100 , O (log n), 100 , , , , 100 , , .

API users want their code to still work, so overall, if you are going to do something much slower, whether it is big-O-slower or not, then it would be better to be a good reason. I would like to release a new interface, and not remove and replace the old one, if possible.

+1
source

All Articles