[Feature Request]: Open resource... performance
Describe your idea in details
One pain point I have experienced for a while now is that the Open resource... window takes a long time to appear. I feel like back around version 15 it was pretty snappy, but that could also be because I worked on smaller projects.
Any way I would like to try and improve the performance of it, but would like some pointers regarding what to investigate and possible avenues to explore.
For what I consider a relatively small project it takes a bit under 2 sec but for what I work on daily it takes about 4 sec. This means that I am often insted opting to use Find in Files instead as it doesn't block my workflow in the same way.
Some relevant logs from the small project:
[17:43:36:314 DVL] PHP: parsed 584 in 11 milliseconds
[17:43:37:691 DVL] PHP: parsed 18296 in 539 milliseconds
[17:43:37:691 DBG] [Main] Rebuilding PHP class cache...
[17:43:37:722 DBG] [Main] Loading 21831 class names into the cache
[17:43:37:722 DBG] [Main] Rebuilding PHP class cache...done
This is on a Ryzen 5950x with 32GB RAM
There are 2 constructors to the OpenResourceDlg (codelitephp\php-plugin\php_open_resource_dlg.cpp), the one that is called is this one:https://github.com/eranif/codelite/blob/master/codelitephp/php-plugin/php_open_resource_dlg.cpp#L45
My guess: the SQL table is the problem, specifically, the integrity check which is called when the database is opened: https://github.com/eranif/codelite/blob/5c4a4e1770c17b75707fe0cf518cd3f53880ea8f/CodeLite/PHP/PHPLookupTable.cpp#L216
For large databases, this can be a time consuming operation.
To confirm this, I would add some logging around it and see how long does it take. If this is the root cause, I would add new method:
void PHPLookupTable::OpenNoChecks(const wxString& workspacePath)
And modify:
void PHPLookupTable::Open(const wxFileName& dbfile)
into:
void PHPLookupTable::Open(const wxFileName& dbfile, bool check_integrity)
Do you have a link to a big PHP open source workspace that I can checkout locally and try it with large database?
For Bladestan it take about 2 sec to open the dialog. Note that you will need to run composer install to download the dependencies first.