Skip to content

Fix proposal map performance with hundreds of markers#13798

Merged
andreslucena merged 7 commits intodevelopfrom
fix/proposals-map
Jan 9, 2025
Merged

Fix proposal map performance with hundreds of markers#13798
andreslucena merged 7 commits intodevelopfrom
fix/proposals-map

Conversation

@alecslupu
Copy link
Copy Markdown
Contributor

@alecslupu alecslupu commented Dec 29, 2024

🎩 What? Why?

During the maintainers meeting, we decided to fix some performance issues in the proposals controller. As a result we need to implement some changes in proposals controller.
In this PR, we change the way the proposals are displayed on the map. Initially we had all the proposals in the component rendered, and now we only display on the map the proposals listed in the current page.

📌 Related Issues

Link your PR to an issue

  • Related to #?
  • Fixes #?

Testing

require "decidim/seeds" 
require "decidim/proposals/seeds"
participatory_space = Decidim::ParticipatoryProcess.first
component = participatory_space.components.where(manifest_name: "proposals").first
500.times {  Decidim::Proposals::Seeds.new(participatory_space:).create_proposal!(component:) }

📷 Screenshots

Please add screenshots of the changes you are proposing
Description

♥️ Thank you!

@github-actions github-actions bot added module: proposals module: meetings type: fix PRs that implement a fix for a bug labels Dec 29, 2024
github-actions[bot]
github-actions bot previously approved these changes Dec 29, 2024
github-actions[bot]
github-actions bot previously approved these changes Dec 29, 2024
github-actions[bot]
github-actions bot previously approved these changes Dec 29, 2024
github-actions[bot]
github-actions bot previously approved these changes Dec 29, 2024
@alecslupu alecslupu marked this pull request as ready for review December 29, 2024 19:34
@alecslupu alecslupu added release: v0.28 Issues or PRs that need to be tackled for v0.28 release: v0.29 Issues or PRs that need to be tackled for v0.29 labels Dec 29, 2024
@alecslupu alecslupu mentioned this pull request Dec 29, 2024
@andreslucena
Copy link
Copy Markdown
Member

I added the instructions on the Testing section with what I've done for confirming the performance issue

@andreslucena andreslucena changed the title Fix proposal map Fix proposal map performance with hundreds of markers Jan 7, 2025
Copy link
Copy Markdown
Member

@andreslucena andreslucena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only have the doubt about the meetings change, but apart from that it works as it should: only showing the first 25 proposals (from the pagination), as it works in Meetings directory and component.

This is the difference in my machine. I'm discarding the first request (as the shakapacker cache needs to be rebuilt). This is with 395 proposals.

Before

 $ time curl -o /dev/null -s http://localhost:3000/processes/fruit-plain/f/7/proposals

________________________________________________________
Executed in   18.02 secs      fish           external
   usr time    5.50 millis    2.24 millis    3.26 millis
   sys time    8.54 millis    1.60 millis    6.95 millis

$ tme curl -o /dev/null -s http://localhost:3000/processes/fruit-plain/f/7/proposals

________________________________________________________
Executed in   21.09 secs      fish           external
   usr time    6.37 millis    2.36 millis    4.01 millis
   sys time    6.54 millis    1.18 millis    5.36 millis

$ tme curl -o /dev/null -s http://localhost:3000/processes/fruit-plain/f/7/proposals

________________________________________________________
Executed in   18.99 secs      fish           external
   usr time    6.08 millis    1.80 millis    4.28 millis
   sys time    5.16 millis    0.00 millis    5.16 millis

After

$ time curl -o /dev/null -s http://localhost:3000/processes/fruit-plain/f/7/proposals

________________________________________________________
Executed in    3.33 secs      fish           external
   usr time    5.17 millis    3.38 millis    1.79 millis
   sys time    7.62 millis    0.20 millis    7.42 millis

$ time curl -o /dev/null -s http://localhost:3000/processes/fruit-plain/f/7/proposals

________________________________________________________
Executed in    3.12 secs      fish           external
   usr time    1.25 millis    0.14 millis    1.11 millis
   sys time    9.18 millis    2.58 millis    6.61 millis

$ time curl -o /dev/null -s http://localhost:3000/processes/fruit-plain/f/7/proposals

________________________________________________________
Executed in    3.04 secs      fish           external
   usr time    5.19 millis    3.33 millis    1.85 millis

So, without a doubt, an improvement for sure. I only have the doubt that I'm mentioning about the meetings change and this can be merged.

Copy link
Copy Markdown
Member

@andreslucena andreslucena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing my review until my last comment is actioned: #13798 (comment)

github-actions[bot]
github-actions bot previously approved these changes Jan 9, 2025
@andreslucena andreslucena merged commit 257576a into develop Jan 9, 2025
@andreslucena andreslucena deleted the fix/proposals-map branch January 9, 2025 11:49
entantoencuanto added a commit that referenced this pull request Jan 14, 2025
* develop: (27 commits)
  WCAG navigation submenu (#13796)
  Update gem dependencies (part 3) (#13849)
  Prevent notifications for deleted users (#13812)
  Retries NPM installation a couple times to prevent network timeouts (#13831)
  Update gem dependencies (part 2) (#13839)
  Enhance signature pdf export (#13778)
  Fix HexaPDF dependency (#13834)
  Fix flaky spec in authentication (#13827)
  Merge upload field for documents and image on proposal admin form (#13735)
  Update gem dependencies (#13835)
  Upgrade erb_lint to 0.8.0 (#13833)
  Fix flaky spec in geocoder (#13820)
  Refactor modules mounting routes (#13294)
  Upgrade check-spelling action (#13825)
  Add missing images in the custom registration emails from meetings (#13632)
  Add missing translations (#13793)
  Fix proposal map performance with hundreds of markers (#13798)
  Create multiple surveys within same Survey component (#13420)
  Accountability bulk actions (#13730)
  Improve UI for sorting options on comments (#13670)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: meetings module: proposals release: v0.28 Issues or PRs that need to be tackled for v0.28 release: v0.29 Issues or PRs that need to be tackled for v0.29 team: performance type: fix PRs that implement a fix for a bug

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants