[Tutor] improving speed using and recalling C functions

Danny Yoo dyoo at hashcollision.org
Fri Apr 11 03:38:17 CEST 2014

> Comment:  You are looping over your sliced eel five times.  Do you
>    need to?  I like eel salad a great deal, as well, but, how about:
>        for k in eel:
>            MYMAP1[i, j, k] = MYMAP1[i, j, k] + myinternet[oo]
>            MYMAP2[i, j, k] = MYMAP2[i, j, k] + myinternet[oo]
>            MYMAP3[i, j, k] = MYMAP3[i, j, k] + myinternet[oo]
>            MYMAP4[i, j, k] = MYMAP4[i, j, k] + myinternet[oo]
>            MYMAP5[i, j, k] = MYMAP5[i, j, k] + myinternet[oo]
>            oo = oo + 1

Hi Gabriele,

Also note that, when Martin looked at this part of the code, he
unfortunately misinterpreted its effect; Martin's proposed rewrite
here does not preserve the meaning of the original code.  But rather
than wag my finger at how Martin interpreted the code, I'd rather make
the observation that this is a warning sign that the original code
here was not easy to understand.

More information about the Tutor mailing list