codelite icon indicating copy to clipboard operation
codelite copied to clipboard

[Feature Request]: Open resource... performance

Open AJenbo opened this issue 11 months ago • 3 comments

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

AJenbo avatar Jan 17 '25 17:01 AJenbo

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)

eranif avatar Jan 19 '25 22:01 eranif

Do you have a link to a big PHP open source workspace that I can checkout locally and try it with large database?

eranif avatar Jan 19 '25 22:01 eranif

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.

AJenbo avatar Jan 19 '25 23:01 AJenbo