Commit Graph

6 Commits

Author SHA1 Message Date
John Ralls
26a179872d Don't create 2 new books for every new session.
And don't ask to save a not-dirty or empty book, fixing
Bug 794870 - If no book is opened, gnucash still asks if the user wants
to save changes when opening a file
2018-09-23 16:42:11 -07:00
Geert Janssens
3634e8f59d Fix memory leak using qof_instance_get on a GncGUID
The underlying boxed type will return a copy so we should free this
when no longer needed.
2018-09-09 22:50:05 +02:00
Robert Fewell
2dcb316280 White space removal and change tabs to spaces in qofbook.cpp/h 2018-08-25 11:10:32 +01:00
Robert Fewell
fd750a22eb Cache the number of days read only value
The KVP value for the qof_book_get_num_days_autoreadonly was being
called many times so it makes sense to cache it in the book to avoid
the KVP lookup.
2018-08-25 11:10:24 +01:00
Christian Stimming
92ea3ba8a6 Register speed-up for large files.
The function qof_book_use_split_action_for_num_field gets called quite a
lot in each register display refresh (due to sorting all splits from
Split.x's xaccSplitOrder function), but it always used to use a KVP
lookup, which is rather expensive compared to accessing a gboolean member
variable.

To get rid of this cost, I had to remove the KVP lookup in this
simple-looking function. The pattern is this: A gboolean cache variable is
introduced, along with an isvalid flag. The lookup makes the expensive
KVP lookup once, then caches the value. The GObject property mechanism
offers a callback for when the setter was called, which is used to mark
the cached value as invalid. A parallel setter method (here:
qof_book_set_option) also just marks the cache as invalid. This covers
all setters, and the getters will use the cached value except for their
first invocation.

The NUM_FIELD_SOURCE feature was introduced in 2012 by the very large
commit 7cdd7372 and apparently its costs never were a problem
until the KVP lookup became more costly due to the std::vector
construction and destruction.
2018-06-22 22:54:33 +02:00
Geert Janssens
83d14e1c1c Restructure the src directory
It is split into
- /libgnucash (for the non-gui bits)
- /gnucash (for the gui)
- /common (misc source files used by both)
- /bindings (currently only holds python bindings)

This is the first step in restructuring the code. It will need much
more fine tuning later on.
2017-08-10 18:45:00 +02:00