-
Notifications
You must be signed in to change notification settings - Fork 483
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
[Builtins] Inline SatInt
stuff and costing monoids
#5062
Conversation
{-# INLINE succ #-} | ||
succ = coerce (succ :: Int -> Int) | ||
|
||
{-# INLINE pred #-} | ||
pred = coerce (pred :: Int -> Int) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michaelpj we still have this bug.
{-# INLINE abs #-} | ||
abs x | ||
| x >= 0 = x | ||
| otherwise = negate x | ||
signum (SI x) = SI (signum x) | ||
| x >= 0 = x | ||
| otherwise = negate x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it a custom definition? How does it handle near-maximum values? Needs a few tests at the very least (unless they're already in place).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically this stuff all got copied from safeint
... which sadly means I don't have good justifications for a bunch of things :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember thinking at the time that we should dump everything from safeInt
except for the few things we actually need.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've checked it and I think the current behavior is as correct as the default one:
>>> (minBound :: SatInt, negate (minBound :: SatInt))
(-9223372036854775808,9223372036854775807)
>>> (minBound :: SatInt, 0 - minBound :: SatInt)
(-9223372036854775808,9223372036854775807)
>>> (maxBound :: SatInt, negate (maxBound :: SatInt))
(9223372036854775807,-9223372036854775807)
>>> (maxBound :: SatInt, 0 - maxBound :: SatInt)
(9223372036854775807,-9223372036854775807)
Maybe it's a custom definition to make it faster or clearer.
Would still be great to have such tests if they're not there.
/benchmark validation |
^ Just experimenting to see if running the benchmarks here uses the same machine that we use manually. Looks like they do. I've cancelled the benchmarking job now. |
4c25a04
to
f999659
Compare
/benchmark plutus-benchmark:validation |
1 similar comment
/benchmark plutus-benchmark:validation |
Click here to check the status of your benchmark. |
1 similar comment
Click here to check the status of your benchmark. |
f999659
to
aa0995c
Compare
/benchmark validation |
Click here to check the status of your benchmark. |
Comparing benchmark results of ' validation' on 'bb6e4ff75' (base) and 'aa0995cdc' (PR) Results table
|
aa0995c
to
58b360e
Compare
/benchmark validation |
Click here to check the status of your benchmark. |
Comparing benchmark results of ' validation' on 'bb6e4ff75' (base) and '58b360e71' (PR) Results table
|
0091d3c
to
8d7623b
Compare
8d7623b
to
232713f
Compare
/benchmark validation |
Click here to check the status of your benchmark. |
Comparing benchmark results of ' validation' on 'bb6e4ff75' (base) and '232713f32' (PR) Results table
|
/benchmark nofib |
Click here to check the status of your benchmark. |
Comparing benchmark results of ' nofib' on 'bb6e4ff75' (base) and '232713f32' (PR) Results table
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine!
Just something I noticed in the Core, needs benchmarking, so don't look here yet.