#26 performance.pre.increment.efficiency

closed
nobody
None
5
2011-02-15
2011-01-02
vBm
No

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

Related

Code: code

Discussion

  • Psychon
    Psychon
    2011-01-02

    If this is supposed to improve performance, do you have any benchmarks that proof this claim?

     
  • Psychon
    Psychon
    2011-02-15

    Sorry, but this doesn't really seem worth it.

    (Also, could someone make gcc optimize away the temporary copy? ;-) )

     
  • Psychon
    Psychon
    2011-02-15

    • status: open --> closed