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

Switch Var to use an Int #1044

Merged
merged 2 commits into from
Jul 2, 2019
Merged

Switch Var to use an Int #1044

merged 2 commits into from
Jul 2, 2019

Conversation

Gabriella439
Copy link
Collaborator

Related to: #1039

We'll probably never see indices that exceed the space of an Int and
the interpreter would probably not be able to handle 9223372036854775807
nested binders anyway.

Related to: #1039

We'll probably never see indices that exceed the space of an `Int` and
the interpreter would probably not be able to handle 9223372036854775807
nested binders anyway.
@@ -336,7 +336,7 @@ instance Pretty Import where
Zero indices are omitted when pretty-printing `Var`s and non-zero indices
appear as a numeric suffix.
-}
data Var = V Text !Integer
data Var = V Text !Int
Copy link
Member

@ocharles ocharles Jul 1, 2019

Choose a reason for hiding this comment

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

Maybe go all the way and {-# UNPACK #-}? It's already strict.

Copy link
Member

Choose a reason for hiding this comment

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

Actually, I think GHC already unpacks these strict fields now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I believe GHC will automatically unbox strict fields if they are no larger than a pointer.

Note that I haven't actually benchmarked this; I'm only forward-porting small chunks of the work mentioned in #1039

@Gabriella439 Gabriella439 merged commit 92bdd56 into master Jul 2, 2019
@Gabriella439 Gabriella439 deleted the gabriel/var_int branch July 2, 2019 00:24
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.

None yet

3 participants