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

Improve JSON API for Install Performance Improvements #19204

Open
1 of 7 tasks
Rylan12 opened this issue Feb 3, 2025 · 3 comments
Open
1 of 7 tasks

Improve JSON API for Install Performance Improvements #19204

Rylan12 opened this issue Feb 3, 2025 · 3 comments
Labels
features New features help wanted We want help addressing this

Comments

@Rylan12
Copy link
Member

Rylan12 commented Feb 3, 2025

Verification

Provide a detailed description of the proposed feature

The formula.json and cask.json files are downloaded almost every time an install or upgrade happens, and these files are large.

  • Shard the JSON files
    • Have a different file for each supported OS, so e.g. formula.arm64_sequoia.json and cask.arm64_sequoia.json
  • Create a new JSON API that contains the minimum information required to download a bottle's manifest file (name, version, hash)
    • Also move tap migrations and other similar config files to live here in a single JSON file
    • For casks, include a marker for whether the ruby file is needed or not
  • Store formula API information in the bottle manifest file
  • When installing a formula, use the new lightweight API and retrieve all missing information needed from the manifest
  • When installing a cask, use the new lightweight API to check whether a new version is needed, and then retrieve the remaining info from the cask's individual JSON file and/or the Ruby file
  • Create a new JSON API file to store formula/cask descriptions that’s downloaded on-demand for brew info or brew search --desc —-eval-all

What is the motivation for the feature?

To make installing formulae and casks via the API faster

How will the feature be relevant to at least 90% of Homebrew users?

Increased performance for all API installs

What alternatives to the feature have been considered?

  • Use a git repo with just the JSON files for each comparison (and since there are only 2 files it shouldn't have the issues we had with homebrew/core)
  • Using BSON and Webpack but they are (including when gzip compressed) larger than gzip compressed JSON
@Rylan12 Rylan12 added the features New features label Feb 3, 2025
@MikeMcQuaid MikeMcQuaid added the help wanted We want help addressing this label Feb 3, 2025
@apainintheneck
Copy link
Contributor

I like this approach and I'm excited to see what this will look like. This seems like an alternative approach to #16410 which maybe should get closed in favor of this one. I did some work on that at the time that got abandoned so feel free to change, use or remove any of the existing logic.

@MikeMcQuaid
Copy link
Member

This seems like an alternative approach to #16410 which maybe should get closed in favor of this one. I did some work on that at the time that got abandoned so feel free to change, use or remove any of the existing logic.

Agreed, thanks. Yeh, we should remove the JSON v3 logic at some point before closing this issue.

@apainintheneck
Copy link
Contributor

Okay, I'll get on removing the JSON v3 logic and I'll tag @Rylan12 to make sure I don't remove anything you plan on using.

apainintheneck added a commit to Homebrew/formulae.brew.sh that referenced this issue Feb 6, 2025
This hasn't been used in a around 8 months since the approach didn't
work as well as we initially hoped. The idea was to reduce the size
of the JSON blob to improve performance.

This PR essentially reverts the following 2 commits:
- 439c237
- 8e4d934

Related Links:
- New approach: Homebrew/brew#19204
- Old approach: Homebrew/brew#16410
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
features New features help wanted We want help addressing this
Projects
None yet
Development

No branches or pull requests

3 participants