Performance issue with obtaining Home Page with 1.3.0

MMEX4Desktop, incl. Windows, macOS (10.10 or newer), and Most Unix variants using the GTK+ toolkit

Moderator: Renato

Post Reply
grumpy
New MMEX User
Posts: 8
Joined: Wed Dec 28, 2016 12:20 pm
Are you a spam bot?: No
Location: UK

Performance issue with obtaining Home Page with 1.3.0

Post by grumpy »

Can no longer report problems anonymously on SourceForge (I guess due to some recent odd entries selling items !) and with their recent reputation do not want to register so logging a further update to https://sourceforge.net/p/moneymanagerex/bugs/917/ here
I have not fixed the problem but have found how to switch it on and off
The "View Reports without Future Transactions" appears to be the culprit which is off by default.

The following is the first few lines from a VS2015 Performance Report (Functions sorted by Inclusive Samples)
Start mmex and shutdown when Homepage appears
With Future OFF - home page almost instant
Function Name Inclusive Samples
__scrt_common_main_seh 828
wxEntry 824
wxEntryReal 824
wxEventLoopBase::Run 479
wxEventLoopManual::DoRun 479
[user32.dll] 468
wxAppConsoleBase::MainLoop 459
wxGUIEventLoop::Dispatch 418
wxEventLoopManual::ProcessEvents 418
wxGUIEventLoop::PreProcessMessage 378
wxGUIEventLoop::ProcessMessage 378
mmGUIApp::OnInit 279
OnInitImpl 279
mmGUIFrame::mmGUIFrame 273
[ucrtbase.dll] 171
mmGUIFrame::createHomePage 149
mmHomePagePanel::Create 143
mmHomePagePanel::mmHomePagePanel 143
wxEvtHandler::ProcessEvent 105
wxEvtHandler::TryHereOnly 103
sqlite3CodecFree 100

and with Future ON - home page takes some 20 seconds to appear
Function Name Inclusive Samples
__scrt_common_main_seh 11,112
wxEntry 11,112
wxEntryReal 11,112
mmGUIApp::OnInit 10,756
OnInitImpl 10,756
mmGUIFrame::mmGUIFrame 10,748
mmGUIFrame::createHomePage 10,565
mmHomePagePanel::Create 10,559
mmHomePagePanel::mmHomePagePanel 10,559
[ucrtbase.dll] 10,545
mmHomePagePanel::getData 10,510
mmHomePagePanel::get_account_stats 10,470
wxGetTimeZone 10,466
ModelBase::to_date 10,435
wxDateTime::ParseISODate 10,425
wxDateTime::ParseFormat 10,423
Model_Checking::TRANSDATE 10,419
wxDateTime::ResetTime 5,236
wxDateTime::Today 5,226
wxDateTime::GetTm 5,211
wxDateTime::TimeZone::TimeZone 2,617
[user32.dll] 407

with Future ON and wxwidgets/timer mod as detailed in 917 - home page almost instant
Function Name Inclusive Samples
__scrt_common_main_seh 541
wxEntry 541
wxEntryReal 541
[user32.dll] 343
wxEventLoopBase::Run 332
wxEventLoopManual::DoRun 332
wxEventLoopManual::ProcessEvents 313
wxGUIEventLoop::Dispatch 312
wxAppConsoleBase::MainLoop 307
wxGUIEventLoop::PreProcessMessage 278
wxGUIEventLoop::ProcessMessage 278
mmGUIApp::OnInit 234
OnInitImpl 234
mmGUIFrame::mmGUIFrame 228
mmGUIFrame::createHomePage 118
mmHomePagePanel::Create 118
mmHomePagePanel::mmHomePagePanel 118
mmGUIFrame::openFile 93

Doing some basic checks suggests that
Line 192 app->m_frame = new mmGUIFrame(app, mmex::getProgramName(), wxPoint(valx, valy), wxSize(valw, valh)); in mmex.cpp is the start of the problem
but working out how this works is beyond my skills.
grumpy
New MMEX User
Posts: 8
Joined: Wed Dec 28, 2016 12:20 pm
Are you a spam bot?: No
Location: UK

Re: Performance issue with obtaining Home Page with 1.3.0

Post by grumpy »

Just downloaded 1.2.7 Portable, opened an old 1.2.7 database (i.e. not upgraded to V7) and can toggle "Future Transactions" with no issue, same is true with 1.2.7 on a V7 database
User avatar
stef145g
MMEX Developer
Posts: 57
Joined: Sat Aug 14, 2010 3:40 am
Are you a spam bot?: No
Location: Canberra, Australia

Re: Performance issue with obtaining Home Page with 1.3.0

Post by stef145g »

grumpy wrote:Can no longer report problems anonymously on SourceForge (I guess due to some recent odd entries selling items !) and with their recent reputation do not want to register so logging a further update to https://sourceforge.net/p/moneymanagerex/bugs/917/ here
You are correct.
I disabled the anonymous reporting due to the fact that we were being bombarded with spam, and nothing to do with MMEX bug reports.

Bug reports can also be supplied on GitHub where the source code can be obtained.

As for the report details, I will attempt to investigate further using vs2015 (community edition) on Win10 (Laptop) machine.
Regards: Stefano
grumpy
New MMEX User
Posts: 8
Joined: Wed Dec 28, 2016 12:20 pm
Are you a spam bot?: No
Location: UK

Re: Performance issue with obtaining Home Page with 1.3.0

Post by grumpy »

Stefano,
Many thanks for looking. I too am using fully patched Win10 on laptop and fully patched VS2015.
You might want to delete Bug 1000 on Sourceforge ?

Done some more digging since yesterday and I think I have confirmed what I originally reported in 917...
The line "if (ignoreFuture && Model_Checking::TRANSDATE(trx).IsLaterThan(today))" in mmhomepagepanel.cpp is the start of the problem as depending on value for "ignoreFuture" then this determines if TRANSDATE is executed.
Executing TRANSDATE leads to "to_date" in Model.h which in turn means that "date.ParseISODate(str_date);" is executed and that means timer.cpp code in wxWidgets is entered.

If I compile 1.2.7 source with VS2015 then the problem is reproducable under 1.2.7 whereas the downloaded 1.2.7 portable code works fine. I guess 1.2.7 portable was compiled with VS2013 and not on Win10 ?

To my mind, this is either a "bug" in Microsoft code and "_tzset" no longer no-ops on subsequent calls or it was never meant to in the first place and Microsoft have "shut the door". Either way problem goes away if my suggested change to timer.cpp (see 917) is made, so maybe a bug for the wxWidgets team ?
grumpy
New MMEX User
Posts: 8
Joined: Wed Dec 28, 2016 12:20 pm
Are you a spam bot?: No
Location: UK

Re: Performance issue with obtaining Home Page with 1.3.0

Post by grumpy »

Stefano,
I am not that confident yet with my C++ skills and the use of push to Github so the following is my two line fix for the problem without modding wxWidgets.

void mmHomePagePanel::get_account_stats(std::map<int, std::pair<double, double> > &accountStats)
{
bool ignoreFuture = Option::instance().IgnoreFutureTransactions();

const auto &transactions = Model_Checking::instance().all();
this->total_transactions_ = transactions.size();
// const wxDateTime today = date_range_->today();
const wxString today = wxDateTime::Today().FormatISODate(); <====
for (const auto& trx : transactions)
{
// if (ignoreFuture && Model_Checking::TRANSDATE(trx).IsLaterThan(today))
if (ignoreFuture && (trx.TRANSDATE > today)) <====
continue; //skip future dated transactions

Avoids calling timer.cpp for around 7000 dates in my current account data and is now as quick as IgnoreFuture=OFF

Might want to remove the following from mmHomePagePanel::GetData() just to keep things tidy ?

date_range_->destroy();
if (Option::instance().IgnoreFutureTransactions())
date_range_ = new mmCurrentMonthToDate;
else
date_range_ = new mmCurrentMonth;
Nikolay
MMEX Developer
Posts: 1535
Joined: Sat Dec 06, 2008 2:27 pm
Are you a spam bot?: No
Location: Sankt-Petersburg, Russia

Re: Performance issue with obtaining Home Page with 1.3.0

Post by Nikolay »

Just want to notice the fix I've provided
https://github.com/moneymanagerex/money ... issues/906
Any 'to date' functions seems working slow.
Nikolay
MMEX Developer
Posts: 1535
Joined: Sat Dec 06, 2008 2:27 pm
Are you a spam bot?: No
Location: Sankt-Petersburg, Russia

Re: Performance issue with obtaining Home Page with 1.3.0

Post by Nikolay »

User avatar
stef145g
MMEX Developer
Posts: 57
Joined: Sat Aug 14, 2010 3:40 am
Are you a spam bot?: No
Location: Canberra, Australia

Re: Performance issue with obtaining Home Page with 1.3.0

Post by stef145g »

I have tested this and have committed it to Master and the v1.3.x branch
Regards: Stefano
grumpy
New MMEX User
Posts: 8
Joined: Wed Dec 28, 2016 12:20 pm
Are you a spam bot?: No
Location: UK

Re: Performance issue with obtaining Home Page with 1.3.0

Post by grumpy »

Thanks guys, works very well, just about instant display of Homepage no matter what the setting of ignoreFuture.

There is a slight delay in displaying all of my 7000 entry Checking Account when I click on it but if I find anything I'll probably register on Github to report what I find.

I'm off to learn a bit more about the power of "Objects" and how to use them !
User avatar
stef145g
MMEX Developer
Posts: 57
Joined: Sat Aug 14, 2010 3:40 am
Are you a spam bot?: No
Location: Canberra, Australia

Re: Performance issue with obtaining Home Page with 1.3.0

Post by stef145g »

grumpy wrote:I'm off to learn a bit more about the power of "Objects" and how to use them !
That is great.
The thing to remember is that we create classes and use the classes as objects. We can also think of an object as an intelligent piece of data. All the specifications of the intelligence is written in the class.  Slightly different approach to straight line programming.

Feel free to join the MMEX team.
Regards: Stefano
Post Reply