Skip to content

perf(core): cache Wier ASTs#2584

Merged
elijah-potter merged 3 commits intoAutomattic:masterfrom
86xsk:cache-weir-ast-lru
Jan 26, 2026
Merged

perf(core): cache Wier ASTs#2584
elijah-potter merged 3 commits intoAutomattic:masterfrom
86xsk:cache-weir-ast-lru

Conversation

@86xsk
Copy link
Copy Markdown
Contributor

@86xsk 86xsk commented Jan 25, 2026

Description

Caches Weir ASTs to avoid reparsing and improve performance.

This improves performance on the lint_essay_uncached bench by ~20%, and reduces the amount of time it takes to run cargo test by (roughly) ~10%.

How Has This Been Tested?

  • cargo test
  • cargo bench

Checklist

  • I have performed a self-review of my own code
  • I have added tests to cover my changes

Copy link
Copy Markdown
Collaborator

@elijah-potter elijah-potter left a comment

Choose a reason for hiding this comment

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

LGTM

@elijah-potter elijah-potter added this pull request to the merge queue Jan 26, 2026
Merged via the queue into Automattic:master with commit 1d6374d Jan 26, 2026
11 checks passed
@86xsk 86xsk deleted the cache-weir-ast-lru branch January 26, 2026 19:22
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Feb 6, 2026
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [Automattic/harper/harper-ls](https://github.com/Automattic/harper) | minor | `v1.5.1` → `v1.6.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>Automattic/harper (Automattic/harper/harper-ls)</summary>

### [`v1.6.0`](https://github.com/Automattic/harper/releases/tag/v1.6.0)

[Compare Source](Automattic/harper@v1.5.1...v1.6.0)

#### What's Changed

- refactor(brill): remove `lazy_static` dependency by [@&#8203;86xsk](https://github.com/86xsk) in [#&#8203;2571](Automattic/harper#2571)
- feat: afterall → after all by [@&#8203;hippietrail](https://github.com/hippietrail) in [#&#8203;2582](Automattic/harper#2582)
- perf(core): cache Wier ASTs by [@&#8203;86xsk](https://github.com/86xsk) in [#&#8203;2584](Automattic/harper#2584)
- deps(cli): bump ariadne from 0.4.1 to 0.6.0 by [@&#8203;86xsk](https://github.com/86xsk) in [#&#8203;2577](Automattic/harper#2577)
- feat: prev → previous by [@&#8203;hippietrail](https://github.com/hippietrail) in [#&#8203;2598](Automattic/harper#2598)
- build(deps): bump uuid from 1.19.0 to 1.20.0 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;2595](Automattic/harper#2595)
- fix: confusing wording in `OneOfTheSingular` by [@&#8203;hippietrail](https://github.com/hippietrail) in [#&#8203;2586](Automattic/harper#2586)
- feat: as of currently→ currently / as of now by [@&#8203;hippietrail](https://github.com/hippietrail) in [#&#8203;2599](Automattic/harper#2599)
- chore: add words/annotations to curated dict by [@&#8203;86xsk](https://github.com/86xsk) in [#&#8203;2570](Automattic/harper#2570)
- feat: nor I would→nor would I by [@&#8203;hippietrail](https://github.com/hippietrail) in [#&#8203;2590](Automattic/harper#2590)
- build(deps): bump sysinfo from 0.37.2 to 0.38.0 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;2594](Automattic/harper#2594)
- fix(chrome-ext): Draft.js multiline suggestion replacement corruption by [@&#8203;draphy](https://github.com/draphy) in [#&#8203;2597](Automattic/harper#2597)
- fix: `rm` old vscode versions after `just test-vscode` by [@&#8203;hippietrail](https://github.com/hippietrail) in [#&#8203;2574](Automattic/harper#2574)
- fix(chrome-ext): force visibility on Reddit by [@&#8203;elijah-potter](https://github.com/elijah-potter) in [#&#8203;2603](Automattic/harper#2603)
- docs(chrome-ext): notify users that Harper will clash with Gmail's grammar checker by [@&#8203;elijah-potter](https://github.com/elijah-potter) in [#&#8203;2605](Automattic/harper#2605)
- feat: yea/yeh →yeah by [@&#8203;hippietrail](https://github.com/hippietrail) in [#&#8203;2604](Automattic/harper#2604)
- fix(obsidian-plugin): postpone initialization until layout is ready by [@&#8203;Vinzent03](https://github.com/Vinzent03) in [#&#8203;2611](Automattic/harper#2611)
- feat: no only is there → not only is there by [@&#8203;hippietrail](https://github.com/hippietrail) in [#&#8203;2610](Automattic/harper#2610)
- feat(chrome-ext): enable use of the CSS Custom Highlights API for Firefox by [@&#8203;elijah-potter](https://github.com/elijah-potter) in [#&#8203;2607](Automattic/harper#2607)
- refactor(core): adjustments in `Number` by [@&#8203;86xsk](https://github.com/86xsk) in [#&#8203;2591](Automattic/harper#2591)
- feat(core): write rule to correct `cybersec` -> `cybersecurity` by [@&#8203;elijah-potter](https://github.com/elijah-potter) in [#&#8203;2613](Automattic/harper#2613)
- fix(chrome-ext): improve test reliability by [@&#8203;elijah-potter](https://github.com/elijah-potter) in [#&#8203;2615](Automattic/harper#2615)
- feat: try one‘s hands at→try one‘s hand at by [@&#8203;hippietrail](https://github.com/hippietrail) in [#&#8203;2614](Automattic/harper#2614)
- feat(core): add `allows` keyword to Weir by [@&#8203;elijah-potter](https://github.com/elijah-potter) in [#&#8203;2602](Automattic/harper#2602)
- build(deps): bump clap from 4.5.54 to 4.5.56 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;2641](Automattic/harper#2641)
- Flash in the pans -> Flashes in the pan by [@&#8203;hippietrail](https://github.com/hippietrail) in [#&#8203;2621](Automattic/harper#2621)
- chore: curate dictionary by [@&#8203;hippietrail](https://github.com/hippietrail) in [#&#8203;2580](Automattic/harper#2580)
- feat: go at war → go to war by [@&#8203;hippietrail](https://github.com/hippietrail) in [#&#8203;2646](Automattic/harper#2646)
- fix(chrome-ext): preserve cursor position in generic contenteditable replacement by [@&#8203;draphy](https://github.com/draphy) in [#&#8203;2617](Automattic/harper#2617)
- feat: peak behind the curtain→peek behind the curtain by [@&#8203;hippietrail](https://github.com/hippietrail) in [#&#8203;2635](Automattic/harper#2635)
- fix: AsciiDoc support by [@&#8203;mcecode](https://github.com/mcecode) in [#&#8203;2633](Automattic/harper#2633)
- build(deps): bump bytes from 1.10.1 to 1.11.1 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;2647](Automattic/harper#2647)
- docs: add Tally to section for projects using Harper by [@&#8203;twocaretcat](https://github.com/twocaretcat) in [#&#8203;2645](Automattic/harper#2645)
- feat(core): improve debug formatting for `Suggestion` by [@&#8203;86xsk](https://github.com/86xsk) in [#&#8203;2619](Automattic/harper#2619)
- refactor(core): adjustments in lexing code by [@&#8203;86xsk](https://github.com/86xsk) in [#&#8203;2618](Automattic/harper#2618)
- feat: look one's nose down→look down one's nose by [@&#8203;hippietrail](https://github.com/hippietrail) in [#&#8203;2644](Automattic/harper#2644)
- feat(core): introduce Weirpacks by [@&#8203;elijah-potter](https://github.com/elijah-potter) in [#&#8203;2491](Automattic/harper#2491)
- fix(lint-framework): preserve cursor position in textarea after applying suggestion by [@&#8203;draphy](https://github.com/draphy) in [#&#8203;2650](Automattic/harper#2650)
- feat: like no tomorrow → like there's no tomorrow by [@&#8203;hippietrail](https://github.com/hippietrail) in [#&#8203;2652](Automattic/harper#2652)
- build(test): improve test build time by [@&#8203;86xsk](https://github.com/86xsk) in [#&#8203;2648](Automattic/harper#2648)
- refactor(core): use a macro and document the methods by [@&#8203;elijah-potter](https://github.com/elijah-potter) in [#&#8203;2655](Automattic/harper#2655)
- build: `panic = abort` and `lto = fat` for release by [@&#8203;86xsk](https://github.com/86xsk) in [#&#8203;2572](Automattic/harper#2572)
- refactor(harper.js): we do not need named types for Weirpacks by [@&#8203;elijah-potter](https://github.com/elijah-potter) in [#&#8203;2657](Automattic/harper#2657)

#### New Contributors

- [@&#8203;twocaretcat](https://github.com/twocaretcat) made their first contribution in [#&#8203;2645](Automattic/harper#2645)

**Full Changelog**: <Automattic/harper@v1.5.1...v1.6.0>

</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 MR becomes conflicted, or you tick the rebase/retry checkbox.

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

---

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

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi45NS4yIiwidXBkYXRlZEluVmVyIjoiNDIuOTUuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6Om1pbm9yIl19-->
hippietrail pushed a commit to hippietrail/harper that referenced this pull request Feb 20, 2026
* perf(core): cache Wier ASTs

* refactor(core): appease Clippy (type complexity)

* perf(core): use `Arc` to avoid double clone

Use `Arc` to avoid cloning `weir_code` a second time on the uncached
path.
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.

2 participants