Skip to content

Use Prism in Sorbet calls (if enabled)#2567

Draft
amomchilov wants to merge 2 commits intomainfrom
Alex/use-prism-in-sorbet-calls
Draft

Use Prism in Sorbet calls (if enabled)#2567
amomchilov wants to merge 2 commits intomainfrom
Alex/use-prism-in-sorbet-calls

Conversation

@amomchilov
Copy link
Copy Markdown
Contributor

@amomchilov amomchilov commented Apr 1, 2026

Motivation

We should use the Prism mode in repos that have it enabled in Sorbet (with --parse=prism in their sorbet/config),

Implementation

Added a simple littleSorbetConfig class which parses the config file, and exposes nicer APIs for reading its various values.

What's the right place to put this? Perhaps in Spoom?

Performance

Shaves off ~1.5 seconds (5%) on the Shopify core monolith.

$ hyperfine --warmup 5 --runs 20 \
  -n "legacy" '~/sorbet-master --no-config --cache-dir= --parser=original --print=symbol-table-json --quiet --stop-after=namer .' \
  -n "prism"  '~/sorbet-master --no-config --cache-dir= --parser=prism    --print=symbol-table-json --quiet --stop-after=namer .'

Benchmark 1: "legacy, no cache"
  Time (mean ± σ):     28.100 s ±  0.795 s    [User: 64.862 s, System: 18.303 s]
  Range (min … max):   27.020 s … 29.405 s    20 runs

Benchmark 2: "prism, no cache"
  Time (mean ± σ):     26.880 s ±  0.494 s    [User: 44.113 s, System: 18.467 s]
  Range (min … max):   25.809 s … 27.619 s    20 runs

Summary
  "prism" ran
    1.05 ± 0.04 times faster than "legacy"

Tests

Added.

@amomchilov amomchilov changed the title Use Prism in Sorbet calls, if enabled Use Prism in Sorbet calls Apr 1, 2026
@amomchilov
Copy link
Copy Markdown
Contributor Author

amomchilov commented Apr 1, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@amomchilov amomchilov changed the title Use Prism in Sorbet calls Use Prism in Sorbet calls (if enabled) Apr 1, 2026
@amomchilov amomchilov added the enhancement New feature or request label Apr 1, 2026
@amomchilov amomchilov force-pushed the Alex/use-prism-in-sorbet-calls branch from 502c337 to 9c3e29b Compare April 1, 2026 01:45
@amomchilov amomchilov marked this pull request as ready for review April 1, 2026 01:46
@amomchilov amomchilov requested a review from a team as a code owner April 1, 2026 01:46
key = key #: as !nil

[key, value]
end.to_h #: Hash[String, String | bool | nil]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How do we get bool?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@amomchilov amomchilov changed the base branch from main to graphite-base/2567 April 1, 2026 18:16
@amomchilov amomchilov force-pushed the Alex/use-prism-in-sorbet-calls branch from 9c3e29b to 0189305 Compare April 1, 2026 18:16
@amomchilov amomchilov changed the base branch from graphite-base/2567 to Alex/extract-sorbet_syntax_check-helper April 1, 2026 18:16
@amomchilov amomchilov requested a review from Morriar April 1, 2026 18:32

# Represents the `sorbet/config` file, and provides access to its options. https://sorbet.org/docs/cli-ref
# If the file doesn't exist, this object will still exist, but will return default values for all options.
class SorbetConfig
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh wow, Claude just spit this out so easily, didn't even realize this already exists: https://github.com/Shopify/spoom/blob/main/lib/spoom/sorbet/config.rb

@amomchilov amomchilov marked this pull request as draft April 1, 2026 18:34
Base automatically changed from Alex/extract-sorbet_syntax_check-helper to main April 1, 2026 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request sorbet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants