I had an algorithm with time-complexity of $O(h\times w)$, knowing $h$ is the height and $w$ is the width of an image being processed (or a simple matrix of size $h\times w$).I managed to reduce the range that the algorithm process. So rather than dealing with $h\times w$ elements, it is dealing with $n\times m$ elements, where $n<h$ and $m<w$.To recapitulate the optimization :Time-complexity of old algorithm is $O(h\times w)$Time-complexity of new algorithm is $O(h) + O(n\times m)$Now my question is : how to express this time complexity optimization in terms of $h$ and $w$ ? is it a real optimization ? 
How to compare the time-complexity of an optimized algorithm with that of the original?
algorithm analysis;time complexity;asymptotics;runtime analysis;performance
I am not sure what you mean by complexity optimization.A proper way to compare complexities is by considering theirratio, which is defined up to a constant factor. Considering the difference makes no sense, as there is alwaysthe invisible constant factor lurking around, invisible but notnegligible.However your problem here is that you have several variables, not thesame in both variants of your algorithm, and no indication of how theyrelate. If you do not say precisely how $n$ and $m$ relate to $h$ and$w$, there is nearly nothing that can be done.Given That all you know is that $n<h$ and $m<w$, the best you can sayis that  $n\times m<h\times w$. But they may differ by a constantadditive term or by a constant multiplicative factor, which does notchange the complexity.So the best you can say is that $O(m\times n)\subseteq O(h\times w)$,short of more precision on how $n$ and $m$ relate to $h$ and$w$Thus $O(h)+O(m\times n)\subseteq O(h)+O(h\times w)$.But $O(h)\subseteq O(h\times w)$, because both are linear in $h$ andthe first is constant in $w$ while the second is linear.Hence you get: $O(h)+O(m\times n)\subseteq O(h\times w)$.All we know is that the complexity is not worse than before.But that should not worry you too much. You seem to have the wrongvision of complexity, when asking:is it a real optimization ? Your optimizations aim at improving performance in your range ofapplications.Complexity does not measure performance but scalability. A  constant multiplicative factor of ten zillions does not change the  complexity but has a drastic effect on performance. The matrix  multiplication algorithm that have the best complexity are never  used because they have abysmal performance. You have to consider  huge matrices for them to be any use.Furthermore, raw complexity on arbitrary measure of the size of theproblem may have little practical meaning in some cases. The relevantsize for some complexity analyses may be the number of occurences of aspecific feature of the problem input, rather than the length of theproblem in number of symbols. Some exponential algorithms areroutinely used without problems because the feature causing the highcomplexity is actually rarely used, independently of the input size.Your modification of the algorithm may be a real optimization, thatmay give you an algorithm ten times faster, but this may not show incomplexity analysis.This is why it is sometimes useful to do precise cost analysis. Butthat is more difficult since you must account for the different costsof different elementary operations (which is not required forcomplexity analysis).A possible way to assess your optimization is benchmarking, ratherthan tedious theoretical counting.Your question did not say whether you were considering worst case oraverage complexity. I did not ask because my remarks apply in bothcases.Note: The fact that the algorithm has better performance, with the sameworst case complexity does not imply that the average complexity wasimproved.