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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache common scalar values #1777

Open
sungam3r opened this issue Dec 3, 2022 · 1 comment 路 May be fixed by #1875
Open

Cache common scalar values #1777

sungam3r opened this issue Dec 3, 2022 · 1 comment 路 May be fixed by #1875

Comments

@sungam3r
Copy link
Contributor

sungam3r commented Dec 3, 2022

    Nice! Seems like a low-risk win 馃憤 

My only thought was whether there'd be any advantage to keeping the static property entirely internal, but seems reasonable to expose it and encourage similar usage in other places.

true and false might also be good candidates for this treatment.

Originally posted by @nblumhardt in #1774 (review)

@sungam3r
Copy link
Contributor Author

sungam3r commented Dec 3, 2022

I suppose such common values:

  1. true and false for bools
  2. empty string
  3. -10...10 int range

Pros:

  • do not allocate for ScalarValue instance and for boxed instance in Value.

Cons:

  • runtime checks for object value

@sungam3r sungam3r linked a pull request Mar 4, 2023 that will close this issue
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 a pull request may close this issue.

1 participant