diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2016-02-10 15:08:46 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2016-02-10 15:46:17 +0100 |
commit | 1da5bdeb986657c5cfd83d495d15b7f2308d3b5b (patch) | |
tree | 258c5297dea9b2296a7ff231c73dd101ff1ab18d /TODO | |
parent | b21d294b8168e20282f31026cbc2e50a3bcd0222 (diff) | |
download | sciteco-1da5bdeb986657c5cfd83d495d15b7f2308d3b5b.tar.gz |
avoid unnecessary undo token allocations in batch mode: greatly speeds up batch mode
* by using variadic templates, UndoStack::push() is now responsible
for allocating undo tokens. This is avoided in batch mode.
* The old UndoStack::push(UndoToken *) method has been made private
to avoid confusion around UndoStack's API.
The old UndoStack::push() no longer needs to handle !undo.enabled,
but at least asserts on it.
* C++11 support is now required, so variadic templates can be used.
This could have also been done using manual undo.enabled checks;
or using multiple versions of the template with different numbers
of template arguments.
The latter could be done if we one day have to support a non-C++11
compiler.
However since we're depending on GCC 4.4, variadic template use should
be OK.
Clang supports it since v2.9.
* Sometimes, undo token pushing passed ownership of some memory
to the undo token. The old behaviour was relied on to reclaim the
memory even in batch mode -- the undo token was always deleted.
To avoid leaks or repeated manual undo.enabled checking,
another method UndoStack::push_own() had to be
introduced that makes sure that an undo token is always created.
In batch mode (!undo.enabled), this will however create the object
on the stack which is much cheaper than using `new`.
* Having to know which kind of undo token is to be pushed (taking ownership
or not) is inconvenient. It may be better to add static methods to
the UndoToken classes that can take care of reclaiming memory.
* Benchmarking certain SciTECO scripts have shown 50% (!!!) speed increases
at the highest possible optimization level (-O3 -mtune=native -march=native).
Diffstat (limited to 'TODO')
-rw-r--r-- | TODO | 10 |
1 files changed, 3 insertions, 7 deletions
@@ -193,9 +193,9 @@ Optimizations: This would almost eradicate Cmdline::process_edit_cmd() and the huge switch-case statement, would be more efficient (but who cares in this case?) and would allow us to -fno-rtti saving a few bytes. - However, this would mean to make some more Cmdline methods public and - it distributes command line behaviour all over SciTECO instead of - concentrating it in the Cmdline class... + However, this would mean to make some more Cmdline methods public. + The implementations of the States' commandline editing handlers + could all be concentrated in cmdline.cpp. * C++14 is supported by GCC 5 and supports new() and delete() operators with a size argument. Replacing these operators with versions using g_slice_alloc() and g_slice_free() should @@ -228,10 +228,6 @@ Optimizations: * can be handled automatically in StateExpectString * but it requires to be able to determine whether we're in the command line macro stack frame and are executing the end of it. - * batch mode can be optimized by preventing unnecessary allocations/deallocations - for UNDO token creation. Check for undo.enabled in constructors like - undo.push_msg|var() where the undo token destruction does not have any - significant side effects. Documentation: * Code docs (Doxygen). It's slowly getting better... |