![]() |
|
Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re^2: Perl PDL slower than python numpyby sgt (Deacon) |
on Sep 22, 2020 at 15:09 UTC ( #11122088=note: print w/replies, xml ) | Need Help?? |
As quick googling shows, default data type for numpy is 32-bit "single precision" "float" Are you really sure? I was surprised by your claim that numpy use a default C float. I am a longtime Perl and C hacker and no python expert. But I view the C float type as kind of archaic I use many math libs and the trend is to go past the C double. It would be surprising for a modern lib like numpy to use such a default. Also float() in python means floating point not C float. Note that I do not really care if tool X is faster that tool Y when the sun, jupiter and the moon are aligned. But I did a bit of web search and could not _quickly_ come up with a definite answer! so I decided to check. Seems that numpy default is a C double:
I think that PDL is really a fantastic piece of software and that it is pretty fast. One possible pitfall, common to all C extensions to Perl, is to go back and forth too many times between Perl and C as that can make a computation much slower. It is often possible to avoid it. hth cheers --sgt
In Section
Seekers of Perl Wisdom
|
|