Hi,
I've finished my work on pp_aassign. I find it ready for review.
Each commit has plenty of details, but here is short description:
* scalar(%h = (1,1,1,1)) returns 4, not 2
* warn on ($s,%h) = (1,{}) as on (%h) = ({})
* (%h = (1)) in list context returns (1, $h{1})
instead of (1)
* return of (%h = (1,1,1)) in list context was incorrect
* in list context returned keys was aliased to RHS scalars
of aassign
* returned list from ((%h, @a) = ...), hash on LHS followed by
array or hash, was incorrect
* implemented right to left algorithm for not magic hash assignment
in scalar and void context
* use less mortals is list context
* in list context hash assignment return keys aliased to RHS
when it's ok (it's not LVALUE context)
You can either look at github [1] or attached patch file with
commits separated.
[1] https://github.com/ruz/perl5/tree/ruz/hash-assignment
Below you can find benchmark results to make sure we either
go faster, stay at the same level or just a little slower. Note that
hash assignment in list+lvalue context is slower (for example
$_++ foreach %h = (1..4)) because of bug fix. Otherwise I'm happy
with results.
Thank you for patience and help.
long array
Rate blead blead-mine
blead 73005.28 - -7.37%
blead-mine 78812.20 7.95% -
long scalar
Rate blead blead-mine
blead 153075.99 - -12.26%
blead-mine 174469.09 13.98% -
long void
Rate blead blead-mine
blead 170382.79 - -2.86%
blead-mine 175402.37 2.95% -
long_dup array
Rate blead blead-mine
blead 154893.39 - -14.54%
blead-mine 181247.32 17.01% -
long_dup scalar
Rate blead blead-mine
blead 198467.19 - -63.58%
blead-mine 544994.42 174.60% -
long_dup void
Rate blead blead-mine
blead 263269.99 - -53.41%
blead-mine 565065.92 114.63% -
short array
Rate blead blead-mine
blead 419975.68 - -14.14%
blead-mine 489133.03 16.47% -
short scalar
Rate blead blead-mine
blead 1067882.60 - -18.15%
blead-mine 1304638.59 22.17% -
short void
Rate blead blead-mine
blead 1260321.03 - -10.20%
blead-mine 1403538.00 11.36% -
short_dup array
Rate blead blead-mine
blead 346151.55 - -14.59%
blead-mine 405289.15 17.08% -
short_dup scalar
Rate blead blead-mine
blead 764348.37 - -34.77%
blead-mine 1171817.64 53.31% -
short_dup void
Rate blead blead-mine
blead 962458.33 - -24.13%
blead-mine 1268637.58 31.81% -
--
Best regards, Ruslan.
Thread Next