New High Performance Python (v0.2) report online

66 views
Skip to first unread message

Ian Ozsvald

unread,
Jul 26, 2011, 12:30:40 PM7/26/11
to shedskin...@googlegroups.com
Hi all, the v0.2 of my High Performance Python report is online:
http://ianozsvald.com/2011/07/25/high-performance-python-tutorial-v0-2-from-europython-2011/

The are no changes for ShedSkin, I have written up the pyCUDA notes
and made small changes for PyPy, I've also added a bit on Algorithmic
Choices.

Since François suggested a few days back that the ShedSkin 0.9 complex
number changes didn't change the speed, I didn't rerun the ShedSkin
tests (and frankly I rather ran out of time too!).

I'm running this tutorial at PyConUK in September, no doubt I'll
update it again in time for that!

Ian.

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

http://IanOzsvald.com
http://SocialTiesApp.com/
http://MorConsulting.com/
http://blog.AICookbook.com/
http://TheScreencastingHandbook.com
http://FivePoundApp.com/
http://twitter.com/IanOzsvald

Mark Dufour

unread,
Jul 26, 2011, 2:34:34 PM7/26/11
to shedskin...@googlegroups.com
hi ian,

The are no changes for ShedSkin, I have written up the pyCUDA notes
and made small changes for PyPy, I've also added a bit on Algorithmic
Choices.

great, thanks for mentioning your update!
 
Since François suggested a few days back that the ShedSkin 0.9 complex
number changes didn't change the speed, I didn't rerun the ShedSkin
tests (and frankly I rather ran out of time too!).

I hadn't tried this either.. but apparently it goes from 4 to 0.15 seconds on my pc.. :-)


mark.
--
http://www.youtube.com/watch?v=E6LsfnBmdnk

François Boutines

unread,
Jul 26, 2011, 2:50:14 PM7/26/11
to shedskin...@googlegroups.com

Idem,
from 0.7 sec to 0.05.

I was talking about the Mandelbrot example in the Shedskin distribution :p

Nice work anyways,

François.

François Boutines

unread,
Jul 26, 2011, 3:09:06 PM7/26/11
to shedskin...@googlegroups.com
2011/7/26 François Boutines <francois...@gmail.com>:

> On Tue, Jul 26, 2011 at 8:34 PM, Mark Dufour <mark....@gmail.com> wrote:
>> hi ian,
>>
>>> The are no changes for ShedSkin, I have written up the pyCUDA notes
>>> and made small changes for PyPy, I've also added a bit on Algorithmic
>>> Choices.
>>
>> great, thanks for mentioning your update!
>>
>>>
>>> Since François suggested a few days back that the ShedSkin 0.9 complex
>>> number changes didn't change the speed, I didn't rerun the ShedSkin
>>> tests (and frankly I rather ran out of time too!).
>>
>> I hadn't tried this either.. but apparently it goes from 4 to 0.15 seconds
>> on my pc.. :-)
>
> Idem,
> from 0.7 sec to 0.05.

For completeness
the new complex version uses 40% less CPU,
50% less memory, 50% less page faults,
and between 20x and 80x less context switches,
on 64 bits multi-core.

François.

Tony

unread,
Jul 26, 2011, 4:35:38 PM7/26/11
to shedskin-discuss
Interesting add I did my tries of shedskining with Mandelbrot GUI with
shedskinned modules. Should include the the colorsys module to next
shedskin as it needs only use cases to compile OK.

hls_to_rgb(1.0, 0.5, 0.7)
rgb_to_hls(1.0, 0.5, 0.7)
yiq_to_rgb(1.0, 0.5, 0.7)
rgb_to_yiq(1.0, 0.5, 0.7)
hsv_to_rgb(1.0, 0.5, 0.7)
rgb_to_hsv(1.0, 0.5, 0.7)

Mandelbrot with Tkinter and ShedSkin http://www.daniweb.com/software-development/python/code/371844

I am bit mystified why my my_mandel module will crash in middle of
generation BMP with IDE's (IDLE and Pythonwin), but not when run
directly. I also find it strange that my old PC with AMD Sempron would
generate Mandelbrots at half the time of Core2Duo in lenovo R60 (0.5 s
vs 1 s). I would like to compliment on the work in improving the file
IO performance of shedskin, now my anagram program takes less than 1 s
to run with shedskin, 0,6 s with psyco and Python 2.6 for my benchmark
case.

On 26 heinä, 19:30, Ian Ozsvald <i...@ianozsvald.com> wrote:
> Hi all, the v0.2 of my High Performance Python report is online:http://ianozsvald.com/2011/07/25/high-performance-python-tutorial-v0-...

Mark Dufour

unread,
Jul 27, 2011, 5:52:52 AM7/27/11
to shedskin...@googlegroups.com
hi tony,

nice program! I tried it here under ubuntu and it works well. I can zoom in and out.. speed seems to be quite a bit better after compilation.. :-)

Interesting add I did my tries of shedskining with Mandelbrot GUI with
shedskinned modules. Should include the the colorsys module to next
shedskin as it needs only use cases to compile OK.

hls_to_rgb(1.0, 0.5, 0.7)
rgb_to_hls(1.0, 0.5, 0.7)
yiq_to_rgb(1.0, 0.5, 0.7)
rgb_to_yiq(1.0, 0.5, 0.7)
hsv_to_rgb(1.0, 0.5, 0.7)
rgb_to_hsv(1.0, 0.5, 0.7)

thanks for this, I will add colorsys support later today! :-)

would you be open to adding your program to the shedskin example set..? it's always nice to add something interactive, and showcase extension module support..

thanks again,
mark.
--
http://www.youtube.com/watch?v=E6LsfnBmdnk

Mark Dufour

unread,
Jul 27, 2011, 6:17:53 AM7/27/11
to shedskin...@googlegroups.com

I was talking about the Mandelbrot example in the Shedskin distribution :p


I guess now that complex numbers are much faster, it may be a good idea to showcase this by modifying the example version to use complex numbers.. any volunteers? :-)

thanks,
mark.
--
http://www.youtube.com/watch?v=E6LsfnBmdnk

Mark Dufour

unread,
Jul 27, 2011, 6:20:50 AM7/27/11
to shedskin...@googlegroups.com
For completeness
the new complex version uses 40% less CPU,

wait - what does this mean..??
 
50% less memory, 50% less page faults,
and between 20x and 80x less context switches,
on 64 bits multi-core.

yeah, the difference between heap+GC and stack/copy-by-value allocation is crazy..

it makes one wonder if we couldn't use stack/copy-by-value allocation for short strings and tuples..

thanks,
mark.
 --
http://www.youtube.com/watch?v=E6LsfnBmdnk

Tony

unread,
Jul 27, 2011, 1:13:35 PM7/27/11
to shedskin...@googlegroups.com
You would be wellcome to do so, just must add my details. Does it crash in Linux also when run from IDLE. It would be nice to find reason for crash when run from IDLE before (further) publishing. The BMP part is from other guy, but codition is only to leave to attribution. One beauty blemish is that my GUI needs PIL package installed, and PIL does not exist for Python 3. On the other hand neither does Shedskin (so better take out the Python3 support gestures). It does also fill hard disk with quite a speed by using uncompressed BMP.

Would be nice to be able to call module from main program and have it compiled as extension module based on use cases from main program without need to touch the original module source code to add them to module with the 'if __name__ == '__main__':' stuff. Of course it is good thing to have testing included in modules when run directly.

It would be interesting if Logo graphics could be speeded up from logo package. It would require some refactoring magic though to move shedskinnable part out to utility module. Tool to do such refactoring would be really nice. There is that shedskin decorator stuff though.

It would be nice to get to know the infered type of expressions by type expressions (not currently supported), which shedskin would reduce to constants (and probably optimizer would optimize out if statement using it).
WebRep
Kokonaisluokitus
 

Ian Ozsvald

unread,
Jul 28, 2011, 6:57:24 AM7/28/11
to shedskin...@googlegroups.com
Ohhhhhh. My bad then for missing this. I've noted it for v0.3.

It turns out I'm not presenting this at EuroSciPy any more (I had an
Accepted As Speaker email but apparently it was sent in error <sigh>),
instead I'm doing a poster. A month later at PyconUK I should be
running the same tutorial.

I'll definitely have everything up to date for these events and the
subsequent writeup.

Cheers,
Ian.

2011/7/26 François Boutines <francois...@gmail.com>:

> --
> You received this message because you are subscribed to the Google Groups "shedskin-discuss" group.
> To post to this group, send email to shedskin...@googlegroups.com.
> To unsubscribe from this group, send email to shedskin-discu...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/shedskin-discuss?hl=en.

Ian Ozsvald

unread,
Jul 28, 2011, 7:02:13 AM7/28/11
to shedskin...@googlegroups.com
I've added a note to the end of the blog post
http://ianozsvald.com/2011/07/25/high-performance-python-tutorial-v0-2-from-europython-2011/
linking to this thread so folk are alerted to the improvement.

Things sure do move fast around here :-)

i.

Mark Dufour

unread,
Jul 28, 2011, 2:48:23 PM7/28/11
to shedskin...@googlegroups.com
hi tony,

On Wed, Jul 27, 2011 at 7:13 PM, Tony <tony.vei...@gmail.com> wrote:
You would be wellcome to do so, just must add my details. Does it crash in Linux also when run from IDLE. It would be nice to find reason for crash

works fine here with idle-python2.7 under ubuntu.. what kind of error do you see?

Mark Dufour

unread,
Jul 28, 2011, 2:51:21 PM7/28/11
to shedskin...@googlegroups.com
It turns out I'm not presenting this at EuroSciPy any more (I had an
Accepted As Speaker email but apparently it was sent in error <sigh>),
instead I'm doing a poster. A month later at PyconUK I should be
running the same tutorial.

awesome :-) I _think_ by that time shedskin 0.9 should be out, including the complex improvements (and a lot more :)).

thanks!
mark.
--
http://www.youtube.com/watch?v=E6LsfnBmdnk

Tony Veijalainen

unread,
Jul 28, 2011, 3:08:39 PM7/28/11
to shedskin...@googlegroups.com

In windows IDLE the program running the my_mandel.py module shedskinned is crashing after first click to zoomin, but if you shedskin the sub-modules instead and keep the my_mandel.py module in python, the program also runs under IDLE.

Mark Dufour

unread,
Jul 28, 2011, 4:41:46 PM7/28/11
to shedskin...@googlegroups.com
hi tony,


In windows IDLE the program running the my_mandel.py module shedskinned is crashing after first click to zoomin, but if you shedskin the sub-modules instead and keep the my_mandel.py module in python, the program also runs under IDLE.

I will try to have a look tomorrow or the day after to see what is happening here..

Mark Dufour

unread,
Jul 30, 2011, 7:50:22 AM7/30/11
to shedskin...@googlegroups.com
>In windows IDLE the program running the my_mandel.py module shedskinned is crashing after first click to zoomin, but if you shedskin the sub-modules instead and keep the my_mandel.py module in python, the program also runs under IDLE.

does it say anything while crashing..?

I just tried here, and when I start idle as follows from the dir with click_sel.py, after running shedskin-0.8\init.bat, everything seems to work fine:

python \python2.6\Lib\idlelib\idle.py

if I start idle from the windows start menu, idle complains about a module it can't find, probably one of those DLL's needed to run as shedskin program. haven't tried with those in the same dir..

Mark Dufour

unread,
Jul 30, 2011, 8:15:37 AM7/30/11
to shedskin...@googlegroups.com
I added your program to the shedskin example set:

http://gitorious.org/shedskin/mainline/trees/master/examples

(mandelbrot2_main.py and mandelbrot2.py)

let me know if you'd like me to change anything.

thanks again!
mark.
--
http://www.youtube.com/watch?v=E6LsfnBmdnk

Tony Veijalainen

unread,
Jul 30, 2011, 11:24:24 AM7/30/11
to shedskin...@googlegroups.com
I was not so happy with the old version (even the list of generated images is memory hog and click position in that seems not reliable after zoom out). So I did some changes of it based on newer version of my code and few new clean ups (like taking out too many debug prints to terminal). See http://www.daniweb.com/software-development/python/code/371844/1612975#post1612975,

By the way it was interesting that you transformed the bmp module to be a class inside included module, any deeper reasons for this? I now used shedskin -b -e to generate the module. It is little pitty though that maybe usefull to others bmp module (not mine, but anyway), is hidden inside other module. Could maybe put note that people can use it by doing from mandel2 import kohn_bmp (and link to that guys site). I scrampled little my email in attributions line.
Reply all
Reply to author
Forward
0 new messages