From: SourceForge.net <no...@so...> - 2011-01-02 18:35:24
|
Patches item #3149823, was opened at 2011-01-02 18:43 Message generated for change (Comment added) made by thevbm You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=672823&aid=3149823&group_id=115828 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: vBm (thevbm) Assigned to: Nobody/Anonymous (nobody) Summary: performance.pre.increment.efficiency Initial Comment: According to cppcheck[1] there is several places where it advices that znc should use pre-increment/decrement. If you think that this is false positive and should not be changed, please tell me, so i can report that back to cppcheck in order to get that fixed. [code]Pre-increment/decrement can be more efficient than post-increment/decrement. Post-increment/decrement usually involves keeping a copy of the previous value around and adds a little extra code.[/code] In order to save your time i've made tiny patch that does exactly that. [1] - https://github.com/danmar/cppcheck/tree/97f7a36e916ee860435ae8d61473d8e8d722afb6 ---------------------------------------------------------------------- >Comment By: vBm (thevbm) Date: 2011-01-02 19:35 Message: Actual benchmark no, but... i++ : * create a temporary copy of i * increment i * return the temporary copy ++i : * increment i * return i I'd say that ++i is more efficient then i++. http://syamsulhasran.blogspot.com/2008/12/c-pre-increment-v-post-increment.html ---------------------------------------------------------------------- Comment By: Psychon (psychon) Date: 2011-01-02 19:10 Message: If this is supposed to improve performance, do you have any benchmarks that proof this claim? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=672823&aid=3149823&group_id=115828 |