mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-12-02 05:29:20 -06:00
Fix XML load CPU hotspot: Scrub.c xaccTransScrubPostedDate
The refactoring provides roughly 10% reduction in user CPU use for XML file load by moving an expensive function to within an if-clause where the result is used. The diff looks like a full re-write but only the if statements, indenting, and commentary changed.
This commit is contained in:
parent
0621abf3b1
commit
0e37e059d5
@ -1395,13 +1395,15 @@ void
|
||||
xaccTransScrubPostedDate (Transaction *trans)
|
||||
{
|
||||
time64 orig = xaccTransGetDate(trans);
|
||||
GDate date = xaccTransGetDatePostedGDate(trans);
|
||||
time64 time = gdate_to_time64(date);
|
||||
/* xaccTransGetDatePostedGDate will return a valid time */
|
||||
if (orig == INT64_MAX && orig != time)
|
||||
if(orig == INT64_MAX)
|
||||
{
|
||||
/* xaccTransSetDatePostedSecs handles committing the change. */
|
||||
xaccTransSetDatePostedSecs(trans, time);
|
||||
GDate date = xaccTransGetDatePostedGDate(trans);
|
||||
time64 time = gdate_to_time64(date);
|
||||
if(time != INT64_MAX)
|
||||
{
|
||||
// xaccTransSetDatePostedSecs handles committing the change.
|
||||
xaccTransSetDatePostedSecs(trans, time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user