2010/7/28 Krzysztof Kosiński <tweenk.pl@...400...>:
W dniu 28 lipca 2010 06:52 użytkownik bulia byak <buliabyak@...400...> napisał:
I don't see any necessity for dynamic generation of keys, and doing a string dup on each undo event sounds unnecessarily wasteful.
~50 bytes of extra memory consumption per document looks like a reasonable price to pay to fix undo in the filter dialog, and possible future places that will need to use dynamic generation of undo keys.
Once again: we don't need dynamic generation of keys. Look a fill&stroke: it just flips between two static strings. It's faster and easier.
It's also much lower than the memory required to store all the static strings. Only the last undo key is stored.
If you're counting static memory, then I'm quite certain that the extra ustring calls and related overhead will easily eat those several bytes of economy you get from eliminating two static strings. On top of which, ustring also allocates dynamic memory, while static strings do not.