Skip to content

Conversation

@Kmeakin
Copy link
Contributor

@Kmeakin Kmeakin commented Jan 13, 2023

Replaces FileRange (ByteRange + FileId) with ByteRange in all surface AST types produced by parsing and consumed by elaboration. This shaves 8 bytes off each of surface::Term and surface::Pattern, and only makes elaboration slightly more complicated, so ought to be a good performance win.

Size changes:

  • surface::Term<ByteRange>: 56 bytes to 48 bytes
  • surface::Pattern<ByteRange>: 16 bytes to 12 bytes

Copy link
Member

@brendanzab brendanzab left a comment

Choose a reason for hiding this comment

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

Oh yeah, I’ve done something like this in the past (having a file id on the elaboration context). It does get a little strange when thinking about how multi-file elaboration fits in. Not sure the best approach there?

Regarding performance, the bigger wins for the binary interpreter is probably going to be related to figuring out how to avoid including spans in values while still allowing us to have decent error messages when the binary interpreter encounters a parse error.

@Kmeakin
Copy link
Contributor Author

Kmeakin commented Jan 16, 2023

It does get a little strange when thinking about how multi-file elaboration fits in. Not sure the best approach there?

Multi-file elaboration should be fine: use a separate elab_context for each file/module, and share item_env (and any other global state) between them.

@Kmeakin Kmeakin requested a review from brendanzab January 17, 2023 02:55
@brendanzab brendanzab merged commit 5932033 into yeslogic:main Jan 17, 2023
@Kmeakin Kmeakin deleted the surface-byterange branch January 17, 2023 04:46
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