Time-cost to copy 4 million doubles?

22 views
Skip to first unread message

Ian Ozsvald

unread,
Nov 16, 2013, 2:55:07 PM11/16/13
to shedskin...@googlegroups.com
I've a follow-up question. For my Julia Set demo the ShedSkin result
is almost as quick as the optimized Cython equivalent (using lists).
However compared to a Cython+nparray variant it is consistently 0.05s
slower.

Checking the build parameters it looks the same (-O2 etc).

I'm suspecting that this might be the cost of copying 4 million
doubles (1 million elements * 2 sets of complex numbers). The complex
numbers will be 8 bytes*2, so:
8bytes * 2 per complex * 2 lists * 1 million per list = 32,000,000 bytes

The output will be integers * 1 million so:
4bytes * 1million = 4MB

Might the copy process take roughly 0.05s in total to copy 32MB of
bytes from Python into an extension module and then 4MB back out? I'm
using a 2 year old 4 core 8GB laptop (fairly modern, high-spec when I
bought it).

I'm not sure what the serialisation/deserialisation process would look
like so I'm not sure if these numbers would make sense.

Might the Boehm GC account for some of this? The GC might only run at
the end of the Julia loop, temporary locals are created but reused in
the tight inner loop.

Any thoughts much appreciated.

Ian.

--
Ian Ozsvald (A.I. researcher)
i...@IanOzsvald.com

http://IanOzsvald.com
http://MorConsulting.com/
http://Annotate.IO
http://SocialTiesApp.com/
http://TheScreencastingHandbook.com
http://FivePoundApp.com/
http://twitter.com/IanOzsvald
http://ShowMeDo.com
Reply all
Reply to author
Forward
0 new messages