News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Custom Watch Script Pluggins

Started by Game_Ender, January 23, 2006, 05:26:49 PM

Previous topic - Next topic

thomas

#45
Luckily not, std::vector would be quite inefficient if it did. operator[] is not bounds-checked in release build (it may throw an error in debug build), so working with a std::vector offers the same performance as an old-style C array. It is just more comfortable.

EDIT:
Hey wait a second... did you say map? :lol:
I could swear I read vector... anyway: STL maps are not supposed to do that, but wxHashMap does.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

duncanka

Quote from: thomas on January 30, 2006, 05:37:13 PM
EDIT:
Hey wait a second... did you say map? :lol:
I could swear I read vector... anyway: STL maps are not supposed to do that, but wxHashMap does.
Actually, according the specifications in Mark Nelson's STL book, operator[] does insert the element in an STL map, although it does not for an STL vector.  If the operator makes people nervous, though, the command to GDB could always just use vector::at().
I'm pretty sure you can also use and dereference iterators in GDB, though, so even for a map, it might be possible to write a compiler-independent script that steps through each map element using iterators - it would presumably ask GDB for (*(iter + element#) ).first and (*(iter + element#) ).second, then combine the two into a single string, for each map element.  Although this would probably take a serious toll in terms of performance, to send and process all these GDB commands and output.
Mandrav, any results on performance using such multiple GDB commands?

mandrav

QuoteMandrav, any results on performance using such multiple GDB commands?

Yes, expect an update today :)
Actually I tested it with vectors and it's almost instantaneous for about 30 elements. I have added "start from" and "count" for array types anyway so the user can watch only the items of interest without sacrificing performance...
Be patient!
This bug will be fixed soon...