News for hackers. Stuff that matters.
Re:Why is this C++ code faster than my hand-written assembly... by gnaritas on Tuesday August 22, 2017 @01:12PM (#15074406)
Yes, and thus a perfect example premature optimization; semantics should define default usage, not some possible micro optimization. This is exactly the kind of case Knuth is talking about, going around doing ++x because you think it's faster when the standard idiom is x++ is premature optimization.
Re:Why is this C++ code faster than my hand-written assembly... by zerr on Tuesday August 22, 2017 @01:32PM (#15074618)
x++ is not the "standard idiom".
Re:Why is this C++ code faster than my hand-written assembly... by mark-r on Tuesday August 22, 2017 @02:23PM (#15075097)
In my experience x++ is far more common than ++x when it doesn't matter which you use, "for" statements for example.
Re:Why is this C++ code faster than my hand-written assembly... by gnaritas on Wednesday August 23, 2017 @01:51PM (#15083574)
Yes, it is.
Re:Why is this C++ code faster than my hand-written assembly... by zerr on Thursday August 24, 2017 @01:11AM (#15087748)
I meant no more than ++x.
Re:Why is this C++ code faster than my hand-written assembly... by gnaritas on Thursday August 24, 2017 @10:32AM (#15090389)
I know what you meant, I don't agree. Scour any large codebase, x++ is far more idiomatic than ++x.
Re:Why is this C++ code faster than my hand-written assembly... by zerr on Friday August 25, 2017 @03:41PM (#15101563)
What about top C++ books? Also when it comes to advancing iterators...
Re:Why is this C++ code faster than my hand-written assembly... by marcosdumay on Tuesday August 22, 2017 @01:32PM (#15074611)
Well, there is no reason for any standard idiom there.

Those `++` and `--` operators are something to avoid anyway.