Skip to content

Flatten scope type list#2628

Merged
AndreasArvidsson merged 8 commits intomainfrom
flattenScopeTypeList
Aug 4, 2024
Merged

Flatten scope type list#2628
AndreasArvidsson merged 8 commits intomainfrom
flattenScopeTypeList

Conversation

@AndreasArvidsson
Copy link
Member

@AndreasArvidsson AndreasArvidsson commented Aug 4, 2024

Brings our dfa compilation time from around 700ms down to about 320ms

Fixes #2614

I had forgot, but we actually do parse <user.any_alphanumeric_key> se we can show the users spoken form in the tutorial. I've now utilize this further and actually add the spoken forms for the glyph scope type in the flattened list.

Note that this implementation is somewhat hacky on purpose. Basically I didn't want to touch our csv parser without first talking to pokey since a lot of these list and spoken forms are used in places like the cheat sheet and the tutorial. What I'm instead doing is keeping all the existing lists and then creating a new list that is a flattened version of them. That way the sheet sheet and other places can still use the individual list and we are only using this flattened larger list for the actual scope type capture. This is probably something we want to revisit later, but for now we're getting a huge boast in dfa compilation time with no changes to the speakable grammar and that I think is a clear win.

Checklist

  • [/] I have added tests
  • [/] I have updated the docs and cheatsheet
  • I have not broken the cheatsheet
  • Run Talon grammar tests

@AndreasArvidsson AndreasArvidsson requested a review from a team as a code owner August 4, 2024 11:00
@AndreasArvidsson AndreasArvidsson added the to discuss Plan to discuss at meet-up label Aug 4, 2024
Copy link
Member

@phillco phillco left a comment

Choose a reason for hiding this comment

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

Looks great! A few suggestions

@AndreasArvidsson AndreasArvidsson added this pull request to the merge queue Aug 4, 2024
Merged via the queue into main with commit 19849e8 Aug 4, 2024
@AndreasArvidsson AndreasArvidsson deleted the flattenScopeTypeList branch August 4, 2024 21:14
cursorless-bot pushed a commit that referenced this pull request Aug 4, 2024
Brings our dfa compilation time from around 700ms down to about 320ms

Fixes #2614

I had forgot, but we actually do parse `<user.any_alphanumeric_key>` se
we can show the users spoken form in the tutorial. I've now utilize this
further and actually add the spoken forms for the glyph scope type in
the flattened list.

Note that this implementation is somewhat hacky on purpose. Basically I
didn't want to touch our csv parser without first talking to pokey since
a lot of these list and spoken forms are used in places like the cheat
sheet and the tutorial. What I'm instead doing is keeping all the
existing lists and then creating a new list that is a flattened version
of them. That way the sheet sheet and other places can still use the
individual list and we are only using this flattened larger list for the
actual scope type capture. This is probably something we want to revisit
later, but for now we're getting a huge boast in dfa compilation time
with no changes to the speakable grammar and that I think is a clear
win.



## Checklist

- [/] I have added
[tests](https://www.cursorless.org/docs/contributing/test-case-recorder/)
- [/] I have updated the
[docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and
[cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet)
- [x] I have not broken the cheatsheet
- [x] Run Talon grammar tests

---------

Co-authored-by: Phil Cohen <phillip@phillip.io>
github-merge-queue bot pushed a commit that referenced this pull request Sep 10, 2024
…orms (#2658)

I have a on purpose conflict where I have `string: doubleQuotes` pair
and `string: string` scope. This allows me to do `string wrap` that will
do double quotes, but `take string` should be all strings not just
double quotes. This worked fine before the dfa optimization where we
flattened the scope types in #2628

Just rearranging the lists so the one with scope types has higher
priority than the list of wrappers fixes this.

## Checklist

- [x] I have added
[tests](https://www.cursorless.org/docs/contributing/test-case-recorder/)
- [/] I have updated the
[docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and
[cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet)
- [/] I have not broken the cheatsheet
cursorless-bot pushed a commit that referenced this pull request Sep 10, 2024
…orms (#2658)

I have a on purpose conflict where I have `string: doubleQuotes` pair
and `string: string` scope. This allows me to do `string wrap` that will
do double quotes, but `take string` should be all strings not just
double quotes. This worked fine before the dfa optimization where we
flattened the scope types in #2628

Just rearranging the lists so the one with scope types has higher
priority than the list of wrappers fixes this.

## Checklist

- [x] I have added
[tests](https://www.cursorless.org/docs/contributing/test-case-recorder/)
- [/] I have updated the
[docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and
[cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet)
- [/] I have not broken the cheatsheet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

to discuss Plan to discuss at meet-up

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate DFA compilation times

2 participants