On Saturday, 19 December 2015 20:50:55 UTC+2,
omarc...@gmail.com wrote:
Please do not erase atributions, it is Usenet and not some web forum so
people won't get whom you quote or to what you reply if you erase those.
Restoring those ...
> I wrote:
> > On Saturday, 19 December 2015 10:08:07 UTC+2, mark wrote:
> > > On 2015-12-19 02:14, Jorgen Grahn wrote:
> > > > Comment from your code (like you say) was:
>
> > > >> (also: windows implementation of STL with debug enabled is absurdly
> > > >> slow, so let's bypass it so our code runs fast in debug).
> > > >
> > > > Even more bizarre, unless the author is sarcastic.
> > >
> > > Huh? They are exactly right.
> >
> > Yes but in a way that makes good trolls indistinguishable
> > from genuine kooks. (Morgan's maxim)
> >
> > What is the point of using debug build and then write hand-optimized code
> > in it? The whole scenario is either eccentric (kook) or good sarcasm (troll)
> > but it is impossible to tell what.
>
> It is neither.
>
> When you work on a game meant to run at real-time / interactive
> frame-rate, when more so a complex game (imagine your typical console
> title) having a debug build that runs a 5 fps is absolutely redhibitory.
Do not use debug build then.
> You want to maximize your debugging capabilities every minute of the
> day while minimizing your performance cost.
The debuggers work excellently with optimized builds. The only
thing that I avoid defining is NDEBUG (because that erases asserts).
>
> That library quoted above (which I wrote, and I wrote that comment) is
> meant to be always-on and always-available and it would be a huge flaws
> if using the library in a debug build took 4 ms of your time every frame.
I use debug versions only in unit-tests and automated tests. It does
not matter for me how long those run on test farm.
> Visual Studio in particular has really harsh (slow) settings by default
> nowadays and this extra cost in unacceptable for a library that may
> process thousands of UI objects every frame.
The slow run-time-checked debug versions of standard containers and
iterators are to track down errors like where someone did 'push_back'
element into a 'vector' and forgot that it *may* invalidate iterators.
Such logic errors are all caught by unit tests quickly so I do not need
those checks in versions that are debugged manually.
>
> People who are finding std::vector satisfactory probably haven't
> been faced with writing a highly efficient and complex video game, in
> a highly competitive environment. Consider that GTA5 is running on the
> PS3 and have a look up at the specs for PS3 on Wikipedia, I can guarantee
> you they aren't using std::vector.
What? Most people who use C++ for anything use it because they need
its excellent performance. Optimized (by decent compiler) code of
'std::vector' is about as good as same thing written in assembler.
> When you gets into small details the implementation of STL classes is
> as varied as they are implementations and this variation can actually be
> an issue with porting.
Fear, Uncertainty and Doubt. There was maybe case or two 20 years ago and
old women of bus-station gossip of it. World has changed.
> Considering how simple it is to rewrite that sort of containers it
> makes sense for many more uses that you can imagine.
Good containers aren't simple to write correctly. I have seen enough
of both kinds. It is tricky to gain authority among guys like you.
Typically I argue with them then let them to waste a week on it and
then demonstrate them how well used 'std' and/or 'boost' containers
are easier to debug, but still beat their "container". Often 5:1.
There are lot of excellent containers written by best and tested by
many. *Choosing* correct one is the trick to learn, not how to
invent yet another square wheel.
> I agree it seems weird for many users of C++ but it is also a reality
> for many developers and it is a lack of imagination and understanding
> of different ecosystems and requirements to consider than rewriting own
> set of containers is so unusual or eccentric.
I do not know what you imagine C++ is commonly used for by these
"many users". Good C++ developers are scarce so most are used only to
write most critical parts of anything.
>
> Back to the original post: is Valgrind report something and there is a
> case of a legit memory leak obviously this is a bug in the library and
> should be reported on the github for said library.
Of course. I have seen also standard libraries leaking memory and
crashing in situations but it happens very rarely and the defects are
repaired rather fast by vendors because lot more people evaluate code of
those, test those and use those.