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

Platform fetch performance improvements #857

Merged
merged 10 commits into from
May 23, 2024

Conversation

gantoine
Copy link
Member

This PR should make loading the home and gallery pages a lot snappier on large libraries.

  • New GUNICORN_WORKERS env variable lets users define how many workers to spin up
  • Defer loading of app-wide resources until all high-priority requests complete
  • Merge all app-wide fetches under single callback

@gantoine gantoine requested a review from zurdi15 May 19, 2024 00:54
Copy link

github-actions bot commented May 19, 2024

Test Results

73 tests  ±0   73 ✅ ±0   22s ⏱️ ±0s
 1 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit eff0967. ± Comparison against base commit 00f1c1b.

♻️ This comment has been updated with latest results.

@gantoine gantoine marked this pull request as draft May 19, 2024 14:50
@gantoine gantoine force-pushed the platform-fetch-perf-improvements branch from a000df3 to fbdf657 Compare May 19, 2024 18:36
@gantoine gantoine force-pushed the platform-fetch-perf-improvements branch from fbdf657 to 9fc8267 Compare May 19, 2024 18:39
platform.firmware_files = [
FirmwareSchema.model_validate(f) for f in sorted(db_platform.firmware, key=lambda x: x.file_name)
]
return platform
Copy link
Member Author

Choose a reason for hiding this comment

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

This is no longer needed since as it turns out performance is unaffected by loading firmware data as well

return db_platform_handler.get_rom_count(self.id)
rom_count = column_property(
select(func.count(Rom.id)).where(Rom.platform_id == id).scalar_subquery()
)
Copy link
Member Author

Choose a reason for hiding this comment

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

Significantly faster since it runs in SQL land instead of making another DB query

}

return response;
},
Copy link
Member Author

Choose a reason for hiding this comment

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

Does what it says; fires a custom event when all network requests are complete, which triggers loading things like the platforms sidebar and heartbeat data.

@gantoine gantoine marked this pull request as ready for review May 21, 2024 18:21
@zurdi15 zurdi15 merged commit f5b5de2 into master May 23, 2024
5 of 6 checks passed
@zurdi15 zurdi15 deleted the platform-fetch-perf-improvements branch May 23, 2024 13:56
@zurdi15 zurdi15 mentioned this pull request May 31, 2024
spiceratops added a commit to spiceratops/k8s-gitops that referenced this pull request Jun 8, 2024
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [rommapp/romm](https://togithub.com/rommapp/romm) | minor | `3.1.0` ->
`3.2.0` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>rommapp/romm (rommapp/romm)</summary>

### [`v3.2.0`](https://togithub.com/rommapp/romm/releases/tag/3.2.0)

[Compare
Source](https://togithub.com/rommapp/romm/compare/3.1.0...3.2.0)

### BIOS file support

We've added the ability to mount (or upload) your BIOS/firmware files
for any of the supported platforms. On top of that, when playing in
browser with our EmulatorJS integration, you'll now be able to select
both a BIOS file to load, and a core (when the system supports more then
1 core). Refer to the EmulatorJS for the complete list of available
cores for each system.

### Sharable & private notes

When viewing a game, you might notice a new tab called "Notes"; this is
your notepad, a blank space to jot down just about anything. With full
Markdown support, you have complete control over the style and layout of
your note.
You're also able to make the note "public" (using the little eye icon
next to the pencil), that is visible to every logged-in user on your
instance. And if they do the same, you'll get access to their note, for
easy sharing of tips and tricks.

|||
|---|---|

|![image](https://togithub.com/rommapp/romm/assets/34356590/84d0d5d4-334d-4bc4-a4a5-e62e7d5f3079)|![image](https://togithub.com/rommapp/romm/assets/34356590/521697ba-608c-4a24-bafc-1933d1fea615)|

### Performance improvements

On collections of 1000+ games/platforms with 250+ roms, we've measured a
10x to 20x improvement in load times. RomM should now feel faster
regardless of the size of your collection, with smoother gallery
navigation, faster loading of games on scroll, and real pagination
support in the list view.

#### What's Changed

- Games notes by [@&#8203;gantoine](https://togithub.com/gantoine) in
[rommapp/romm#828
- Copy download link dialog by
[@&#8203;zurdi15](https://togithub.com/zurdi15) in
[rommapp/romm#846
- Firmware/BIOS support by
[@&#8203;gantoine](https://togithub.com/gantoine) in
[rommapp/romm#830
- Upgraded front packages and adapted code by
[@&#8203;zurdi15](https://togithub.com/zurdi15) in
[rommapp/romm#847
- Python package changes by
[@&#8203;gantoine](https://togithub.com/gantoine) in
[rommapp/romm#844
- Fixed gallery play button for not supported platforms by
[@&#8203;zurdi15](https://togithub.com/zurdi15) in
[rommapp/romm#848
- Fixed updating user images and ignore firmware files based on config
by [@&#8203;gantoine](https://togithub.com/gantoine) in
[rommapp/romm#851
- Purge platforms correctly on scan by
[@&#8203;gantoine](https://togithub.com/gantoine) in
[rommapp/romm#858
- Ruff-only pre-commit hooks by
[@&#8203;gantoine](https://togithub.com/gantoine) in
[rommapp/romm#855
- Added amiibo platform icon by
[@&#8203;Casuallynoted](https://togithub.com/Casuallynoted) in
[rommapp/romm#869
- Fixed emulatorjs game loading when game have non-ascii characters in
the name by [@&#8203;vincywindy](https://togithub.com/vincywindy) in
[rommapp/romm#872
- Fix search by ID for mobygames by
[@&#8203;gantoine](https://togithub.com/gantoine) in
[rommapp/romm#863
- Platform fetch performance improvements by
[@&#8203;gantoine](https://togithub.com/gantoine) in
[rommapp/romm#857
- Fixed uploading images for roms and users by
[@&#8203;gantoine](https://togithub.com/gantoine) in
[rommapp/romm#874
- Fixed rom download by
[@&#8203;vincywindy](https://togithub.com/vincywindy) in
[rommapp/romm#876
- Improved general performance (10x faster load at home page and
galleries) by [@&#8203;gantoine](https://togithub.com/gantoine) in
[rommapp/romm#875
- Fixed scan view selectors by
[@&#8203;zurdi15](https://togithub.com/zurdi15) in
[rommapp/romm#878
- Whats new link fixed by
[@&#8203;zurdi15](https://togithub.com/zurdi15) in
[rommapp/romm#880
- Only scan platform when selected by
[@&#8203;gantoine](https://togithub.com/gantoine) in
[rommapp/romm#882
- Improved performance of Rom DB fetch by
[@&#8203;gantoine](https://togithub.com/gantoine) in
[rommapp/romm#883

#### New Contributors

- [@&#8203;vincywindy](https://togithub.com/vincywindy) made their first
contribution in
[rommapp/romm#872
- [@&#8203;Deekerman](https://togithub.com/Deekerman) a special shoutout
for being a right PITA

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zODIuNCIsInVwZGF0ZWRJblZlciI6IjM3LjM4Mi40IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9jb250YWluZXIiLCJ0eXBlL21pbm9yIl19-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants