-
Notifications
You must be signed in to change notification settings - Fork 60
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
optimize head/tail #70
base: master
Are you sure you want to change the base?
Conversation
XSRETURN( end - start ); | ||
while (--size >= 0) { | ||
++SP; | ||
*SP = *(SP + start); |
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.
Hmm.. This is quite the change of behaviour - we're now returning aliases of the original input list, rather than new temporary SVs that copy it. This would have a change of behaviour in lvalue context; for example
my @n = (1 .. 10);
$_++ for tail 4, @n;
I'm undecided if that's a good thing or not.
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.
If such code wouldn't work before, I'd say this would just be a new feature...
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.
It could be considered a feature yes. But it's a somewhat surprising change of behaviour. Is there a chance of accidental collateral damage?
I've asked for further opinion on p5p@ since it's a core module.
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.
Returning aliases is the behavior I would expect.
Seeing e559254, I couldn't pass. This greatly speeds it up and cuts code to half from the original.