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

Performance when first loading many features. #482

Closed
lol2x opened this issue Mar 7, 2022 · 3 comments
Closed

Performance when first loading many features. #482

lol2x opened this issue Mar 7, 2022 · 3 comments
Assignees

Comments

@lol2x
Copy link
Contributor

lol2x commented Mar 7, 2022

I've already read all issues about performance problems with many features but I feel like there is something missing. The performance problem is there only on the first load of the geoJSON to the VlSourceVector, then after ~10-20 seconds everything works smooth (zooming, rotating, moving).
I've tried to test the loading with Chrome built-in performance tab and it shows
Chrome performance analysis
that the function which takes 18 seconds is difference() used here:

this.removeFeatures(difference(

But i can't understand what this function is trying to compare and delete on the first (initial load of the features). Not sure if it is a bug or correct behaviour.

@ghettovoice ghettovoice self-assigned this Mar 7, 2022
@ghettovoice
Copy link
Owner

Hello @lol2x ,
interesting result...
difference is used to find features that is in the OpenLayers Vector source but not in the new features prop value. However on the first load the source is empty, difference shouldn't take so much time. I need to review this place...
Thanks for investigation!

@lol2x
Copy link
Contributor Author

lol2x commented Mar 7, 2022

Hi @ghettovoice,
I've taken the code from the branch you created and the results are great! now whole task (for the same dataset) takes less then 4 seconds (previously almost 23 seconds)
New chrome performance screenshot:
Chrome performance after changes

out of curiosity:
do you think that it will be possible to delegate whole task of reading features to webworker? Will be great to load them without blocking the main thread.

@lol2x lol2x changed the title Performance when fist loading many features. Performance when first loading many features. Mar 7, 2022
@ghettovoice
Copy link
Owner

do you think that it will be possible to delegate whole task of reading features to webworker? Will be great to load them without blocking the main thread.

Hard to say for me...
As I know they allow passing as message only simple data. So I see only the opportunity to move to the worker only a part of resolving list of add/remove features, but the actual add/remove still need to be done in the main thread. I doubt that it's worth it.
Maybe I wrong, because I don't much experienced with webworkers and especially in Vue env.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants