Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expression variables are calculated too often #60112

Open
2 tasks done
Joonalai opened this issue Jan 10, 2025 · 0 comments
Open
2 tasks done

Expression variables are calculated too often #60112

Joonalai opened this issue Jan 10, 2025 · 0 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter!

Comments

@Joonalai
Copy link
Contributor

Joonalai commented Jan 10, 2025

What is the bug or the crash?

When trying to figure out why QGIS gets frozen and really slow with more than 200 layers, I noticed expression variables are calculated really often.

Steps to reproduce the issue

To reproduce the issue it's easiest to add log line to QgsExpressionContextUtils::layerScope method and then do following steps:

  1. Add layer to the project
  2. Digitize one feature
  3. Move map canvas
  4. Calculate lines on the log panel

These simple steps produce 85 lines for memory polygon layer, 123 lines for gpkg polygon layer and 226 lines for PostGIS layer.

too-many-calculations

Versions

Version details <style type="text/css"> p, li { white-space: pre-wrap; } </style>
QGIS version 3.40.2-Bratislava
QGIS code revision 14826ca
 
Libraries
Qt version 5.15.13
Python version 3.12.3
GDAL/OGR version 3.8.4
PROJ version 9.4.0
EPSG Registry database version v11.004 (2024-02-24)
GEOS version 3.12.1-CAPI-1.18.1
SQLite version 3.45.1
PostgreSQL client version 16.6 (Ubuntu 16.6-0ubuntu0.24.04.1)
SpatiaLite version 5.1.0
QWT version 6.1.4
QScintilla2 version 2.14.1
OS version Ubuntu 24.04.1 LTS
 
Active Python plugins
db_manager 0.1.20
MetaSearch 0.3.6
processing 2.12.99
grassprovider 2.12.99
QGIS version 3.40.2-Bratislava QGIS code revision [14826ca](https://github.com/qgis/QGIS/commit/14826ca1e4a)

Libraries
Qt version
5.15.13
Python version
3.12.3
GDAL/OGR version
3.8.4
PROJ version
9.4.0
EPSG Registry database version
v11.004 (2024-02-24)
GEOS version
3.12.1-CAPI-1.18.1
SQLite version
3.45.1
PostgreSQL client version
16.6 (Ubuntu 16.6-0ubuntu0.24.04.1)
SpatiaLite version
5.1.0
QWT version
6.1.4
QScintilla2 version
2.14.1
OS version
Ubuntu 24.04.1 LTS

Active Python plugins
db_manager
0.1.20
MetaSearch
0.3.6
processing
2.12.99
grassprovider
2.12.99

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

Additional context

Maybe some kind of caching should be used to limit amount of times variables are calculated?

@Joonalai Joonalai added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter!
Projects
None yet
Development

No branches or pull requests

1 participant