[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: [OF miscellaneous] Hilbert curve: recursion faster than loop?

**From**: |
Juan Pablo Carbajal |

**Subject**: |
Re: [OF miscellaneous] Hilbert curve: recursion faster than loop? |

**Date**: |
Mon, 7 Aug 2017 14:51:24 +0200 |

>*> Octave 4.0.1*
>*>*
>*> 7.34 ms [0.11 ms]*
>*> 4.73 ms [0.06 ms]*
>*> 1.27 ms [0.03 ms]*
>*>*
>*> Octave 4.3.0+*
>*>*
>*> 7.61 ms [0.16 ms]*
>*> 4.82 ms [0.05 ms]*
>*> 1.42 ms [0.03 ms]*
>*>*
>*> Matlab R2016b*
>*>*
>*> 8.65 ms [0.58 ms]*
>*> 2.98 ms [0.10 ms]*
>*> 1.30 ms [0.08 ms]*
>
>* Same figures here except for nuances using Octave 4.3.0+ and Matlab R2017a*
>* as Juan and jbect got.*
Thanks jbect and Kai.
The lesson learned seems to be that recursion can beat loops and pre-allocation.
It seems matlab is even worse than Octave at slicing and asignation
(assuming second line is the iterations without allocation). Does
anybody know how is this possible? Why is re-writting an array's
values more expensive than extending the array?
I guess we will stick to the recursion then, and maybe to move it to
C++, hopping this will further reduce the cost.

**[OF miscellaneous] Hilbert curve: recursion faster than loop?**, *JuanPi*, `2017/08/05`
**Re: [OF miscellaneous] Hilbert curve: recursion faster than loop?**, *siko1056*, `2017/08/06`
**Re: [OF miscellaneous] Hilbert curve: recursion faster than loop?**, *Juan Pablo Carbajal*, `2017/08/07`
**Re: [OF miscellaneous] Hilbert curve: recursion faster than loop?**, *Juan Pablo Carbajal*, `2017/08/07`
**Re: [OF miscellaneous] Hilbert curve: recursion faster than loop?**, *siko1056*, `2017/08/07`
**Re: [OF miscellaneous] Hilbert curve: recursion faster than loop?**, *Juan Pablo Carbajal*, `2017/08/07`
**Re: [OF miscellaneous] Hilbert curve: recursion faster than loop?**, *Julien Bect*, `2017/08/07`
**Re: [OF miscellaneous] Hilbert curve: recursion faster than loop?**, *siko1056*, `2017/08/07`
**Re: [OF miscellaneous] Hilbert curve: recursion faster than loop?**,
*Juan Pablo Carbajal* **<=**
**Re: [OF miscellaneous] Hilbert curve: recursion faster than loop?**, *Juan Pablo Carbajal*, `2017/08/07`