[pypy-dev] The correct way to incrementally build list in RPython
Yichao Yu
yyc1992 at gmail.com
Fri Jun 27 15:17:26 CEST 2014
On Fri, Jun 27, 2014 at 6:37 PM, Armin Rigo <arigo at tunes.org> wrote:
> Hi Yichao,
>
> On 27 June 2014 12:17, Yichao Yu <yyc1992 at gmail.com> wrote:
>> I am still creating a tuple out of these 5 numbers/strings since I
>> don't want to duplicate the hash functions for all of them. Can the
>> compiler deal with this case efficiently?
>
> If by "deal with this case efficiently" you mean, will the compiler
> remove the tuple allocation and inline the 5-elements hash, then it
> might just be possible depending on a number of details, but I doubt
> it. Better to be explicit. I had in mind something like:
>
> my_hash = num1 * 1000003
> my_hash = (my_hash ^ num2) * 1000003
> my_hash = (my_hash ^ compute_hash(string3))
> my_hash = intmask(my_hash) # at the end
>
Done
>
> A bientôt,
>
> Armin.
More information about the pypy-dev
mailing list