-
Notifications
You must be signed in to change notification settings - Fork 146
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
#2716: tuple optimization #2898
#2716: tuple optimization #2898
Conversation
@maxonfjvipon please check |
^.at.at-without-checks index | ||
|
||
# Takes element from the tuple without checking i. | ||
# i must be less than length and greater or equal 0. |
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.
@levBagryansky i
actually may be any object, it's not mandatory i
to be int
. It can be for example
[] > my-i
[x] > lt
TRUE > @
And it will work. So I would say that it's expected i
has lt
attribute and we don't check its value
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.
@maxonfjvipon i should be int. Otherwise the object does not have sense
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.
@levBagryansky It should not and we can't guarantee it. All we need that i
has attribute lt
with 1 free attribute. That's it
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.
What will be (* 1 2 3) .at my-int
here? Not ub but something like that, because then the method guarantees nothing
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.
@maxonfjvipon Also I did not write that i
should be int
. i must be less than length and greater or equal 0. That is all. If you object is less than length and greater or equal to 0 then you can use this method.
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.
@levBagryansky but x.lt y
is not supposed to mean "x is less than y"
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.
Supposed to be. Actually it is abstraction. We have polymorphism here.
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.
We can remove it if it seems confusing
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.
@levBagryansky I would propose something like this for the description:
"Takes element from the tuple without index validation.
Here i
must be an object that can be comparable with int
using lt
method."
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.
@yegor256 please check |
1 similar comment
@yegor256 please check |
@rultor merge |
@rultor status |
@yegor256 This is what's going on here:
More information about Rultor commands you can get here. |
Relates to #2716
This pr makes
tuple.at
faster. Testing time decreased by 2 times on my laptop.Such test became more than 10 times faster:
PR-Codex overview
This PR adds new tests and a method
at-without-checks
to thetuple
object in theeo-runtime
.Detailed summary
at-without-checks
method with first and last elementat-without-checks
method totuple
object for retrieving elements without index validation