The document outlines a presentation about PyPy 1.2 given on May 8, 2010. It discusses what's new in PyPy 1.2, including speed improvements from the just-in-time (JIT) compiler. It provides an overview of the JIT and demos how PyPy can be used now. The document also discusses what works and doesn't work on PyPy, such as most pure Python modules working but not all extension modules. Overall, PyPy 1.2 provides significant speed improvements over CPython and Psyco through its JIT compiler.
Python, the Language of Science and Engineering for EngineersBoey Pak Cheong
A talk given in November 2016 at IEM Malaysia to engineers, who are new to Python, a broad perspective of what Python is, why it is important to learn it and how it can help in solving/visualization of engineering and scientific tasks and problems.
This is the presentation I gave about Python 3.5 to my research group. It was my intention to introduce the Python language to some of the new members who don't know or have little knowledge about the language.
This presentation educates you about Python and the reason for learning python, Key advantages of learning Python, Characteristics of Python, Hello World using Python syntax and Applications of Python.
For more topics stay tuned with Learnbay.
Introduction about Python by JanBask Training, we are offering Online Pyton Training. You should visit: http://www.janbasktraining.com/python/ for Pyton Training.
Python is a basic term for the programming language which anyone can generally work. in this blog, you briefly learn about benefits & Advantages and disadvantages of python
Python tutorial for beginners - Tib academyTIB Academy
Get python training through simple tutorial from TIB Academy, through this python tutorial you can lean more topics of python. you can download python tutorial free as PPT
Open source general-purpose. Multiplatform programming language
Object Oriented, Procedural, Functional
Easy to interface with C/ObjC/Java/Fortran
Easy to interface with C++ (via SWIG)
Great interactive environment
Python 'philosophy' emphasis readability, clarity and simplicity
The Interactive Interpreter
it is very easy to learn and understand.
Python, the Language of Science and Engineering for EngineersBoey Pak Cheong
A talk given in November 2016 at IEM Malaysia to engineers, who are new to Python, a broad perspective of what Python is, why it is important to learn it and how it can help in solving/visualization of engineering and scientific tasks and problems.
This is the presentation I gave about Python 3.5 to my research group. It was my intention to introduce the Python language to some of the new members who don't know or have little knowledge about the language.
This presentation educates you about Python and the reason for learning python, Key advantages of learning Python, Characteristics of Python, Hello World using Python syntax and Applications of Python.
For more topics stay tuned with Learnbay.
Introduction about Python by JanBask Training, we are offering Online Pyton Training. You should visit: http://www.janbasktraining.com/python/ for Pyton Training.
Python is a basic term for the programming language which anyone can generally work. in this blog, you briefly learn about benefits & Advantages and disadvantages of python
Python tutorial for beginners - Tib academyTIB Academy
Get python training through simple tutorial from TIB Academy, through this python tutorial you can lean more topics of python. you can download python tutorial free as PPT
Open source general-purpose. Multiplatform programming language
Object Oriented, Procedural, Functional
Easy to interface with C/ObjC/Java/Fortran
Easy to interface with C++ (via SWIG)
Great interactive environment
Python 'philosophy' emphasis readability, clarity and simplicity
The Interactive Interpreter
it is very easy to learn and understand.
Talk at PyCon2022 over building binary packages for Python. Covers an overview and an in-depth look into pybind11 for binding, scikit-build for creating the build, and build & cibuildwheel for making the binaries that can be distributed on PyPI.
Python Basics: A Complete Introduction to Python3.Your Complete Python Curriculum— With Exercises, Interactive Quizzeresources, and Sample python programs.Python for beginners to excel in their careers in programming
Amazon EC2 may offer the possibility of high performance computing to programmers on a budget. Instead of building and maintaining a permanent Beowulf cluster, we can launch a cluster on-demand using Python and EC2. This talk will cover the basics involved in getting your own cluster running using Python, demonstrate how to run some large parallel computations using Python MPI wrappers, and show some initial results on cluster performance.
CrashCourse: Python with DataCamp and Jupyter for BeginnersOlga Scrivner
Crash course for beginners is based on Python Introduction by Philip Schowenaars from DataCamp and Jupyter Introduction adapted from Adapted from Pryke, B. (2018). Jupyter Notebook for Beginners: A Tutorial. DataQuest. https://www.dataquest.io/blog/jupyter-notebook-tutorial/
Python is a great programming language. It is a complete tutorial of using this programming language.
This slides is split into two parts, and it is the first part. Another part is at: http://www.slideshare.net/moskytw/programming-with-python-adv.
The slides shown here have been used for talks given to scientists in informal contexts.
Python is introduced as a valuable tool for both producing and evaluating data.
The talk is essentially a guided tour of the author's favourite parts of the Python ecosystem. Besides the Python language itself, NumPy and SciPy as well as Matplotlib are mentioned.
A last part of the talk concerns itself with code execution speed. With this problem in sight, Cython and f2py are introduced as means of glueing different languages together and speeding Python up.
The source code for the slides, code snippets and further links are available in a git repository at
https://github.com/aeberspaecher/PythonForScientists
Josh Williams
You may be familiar with connecting to a database using Python, but did you know it's possible for your database itself to use Python? PostgreSQL has the ability to write functions and procedures in PL/Python, which can use Python to both work with data inside your database, and bring in information from the outside world. This tutorial-format demonstration is designed to show you how to get up and running on PL/Python, and some of the cool things you can accomplish using it.
Similar to PyPy 1.2: snakes never crawled so fast (20)
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfPaige Cruz
Monitoring and observability aren’t traditionally found in software curriculums and many of us cobble this knowledge together from whatever vendor or ecosystem we were first introduced to and whatever is a part of your current company’s observability stack.
While the dev and ops silo continues to crumble….many organizations still relegate monitoring & observability as the purview of ops, infra and SRE teams. This is a mistake - achieving a highly observable system requires collaboration up and down the stack.
I, a former op, would like to extend an invitation to all application developers to join the observability party will share these foundational concepts to build on:
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
Removing Uninteresting Bytes in Software FuzzingAftab Hussain
Imagine a world where software fuzzing, the process of mutating bytes in test seeds to uncover hidden and erroneous program behaviors, becomes faster and more effective. A lot depends on the initial seeds, which can significantly dictate the trajectory of a fuzzing campaign, particularly in terms of how long it takes to uncover interesting behaviour in your code. We introduce DIAR, a technique designed to speedup fuzzing campaigns by pinpointing and eliminating those uninteresting bytes in the seeds. Picture this: instead of wasting valuable resources on meaningless mutations in large, bloated seeds, DIAR removes the unnecessary bytes, streamlining the entire process.
In this work, we equipped AFL, a popular fuzzer, with DIAR and examined two critical Linux libraries -- Libxml's xmllint, a tool for parsing xml documents, and Binutil's readelf, an essential debugging and security analysis command-line tool used to display detailed information about ELF (Executable and Linkable Format). Our preliminary results show that AFL+DIAR does not only discover new paths more quickly but also achieves higher coverage overall. This work thus showcases how starting with lean and optimized seeds can lead to faster, more comprehensive fuzzing campaigns -- and DIAR helps you find such seeds.
- These are slides of the talk given at IEEE International Conference on Software Testing Verification and Validation Workshop, ICSTW 2022.
UiPath Test Automation using UiPath Test Suite series, part 5DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 5. In this session, we will cover CI/CD with devops.
Topics covered:
CI/CD with in UiPath
End-to-end overview of CI/CD pipeline with Azure devops
Speaker:
Lyndsey Byblow, Test Suite Sales Engineer @ UiPath, Inc.
Climate Impact of Software Testing at Nordic Testing DaysKari Kakkonen
My slides at Nordic Testing Days 6.6.2024
Climate impact / sustainability of software testing discussed on the talk. ICT and testing must carry their part of global responsibility to help with the climat warming. We can minimize the carbon footprint but we can also have a carbon handprint, a positive impact on the climate. Quality characteristics can be added with sustainability, and then measured continuously. Test environments can be used less, and in smaller scale and on demand. Test techniques can be used in optimizing or minimizing number of tests. Test automation can be used to speed up testing.
Communications Mining Series - Zero to Hero - Session 1DianaGray10
This session provides introduction to UiPath Communication Mining, importance and platform overview. You will acquire a good understand of the phases in Communication Mining as we go over the platform with you. Topics covered:
• Communication Mining Overview
• Why is it important?
• How can it help today’s business and the benefits
• Phases in Communication Mining
• Demo on Platform overview
• Q/A
Dr. Sean Tan, Head of Data Science, Changi Airport Group
Discover how Changi Airport Group (CAG) leverages graph technologies and generative AI to revolutionize their search capabilities. This session delves into the unique search needs of CAG’s diverse passengers and customers, showcasing how graph data structures enhance the accuracy and relevance of AI-generated search results, mitigating the risk of “hallucinations” and improving the overall customer journey.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
Threats to mobile devices are more prevalent and increasing in scope and complexity. Users of mobile devices desire to take full advantage of the features
available on those devices, but many of the features provide convenience and capability but sacrifice security. This best practices guide outlines steps the users can take to better protect personal devices and information.
Unlocking Productivity: Leveraging the Potential of Copilot in Microsoft 365, a presentation by Christoforos Vlachos, Senior Solutions Manager – Modern Workplace, Uni Systems
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
Elevating Tactical DDD Patterns Through Object Calisthenics
PyPy 1.2: snakes never crawled so fast
1. PyPy 1.2: snakes never crawled so fast
Antonio Cuni
Armin Rigo
Pycon Italia Qu4ttro
May 8 2010
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 1 / 35
2. Outline
PyPy 1.2: what’s new and status update
Overview of the JIT
Demo: how to use PyPy right now
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 1 / 35
3. Part 0: What is PyPy? :-)
Python interpreter written in Python
Framework for developing dynamic languages
etc. etc.
From the user point of view
An alternative to CPython
with more features!
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 2 / 35
4. Part 0: What is PyPy? :-)
Python interpreter written in Python
Framework for developing dynamic languages
etc. etc.
From the user point of view
An alternative to CPython
with more features!
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 2 / 35
5. Part 1
What’s new and status update
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 3 / 35
6. What’s new in PyPy 1.2
Released on March 12th, 2010
Main theme: speed
JIT compiler
speed.pypy.org
Ubuntu packages
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 4 / 35
7. Speed: PyPy vs CPython
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 5 / 35
8. Speed: PyPy vs Psyco
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 6 / 35
9. Speed: Demo
Django application
Mandelbrot fractal
fished randomly on the net :-)
Run both on CPython and PyPy
django trunk!
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 7 / 35
10. What works on PyPy
Pure Python modules should Just Work (TM)
django trunk
twisted, nevow
pylons
bittorrent
...
lot of standard modules
__builtin__ __pypy__ _codecs _lsprof _minimal_curses
_random _rawffi _socket _sre _weakref bz2 cStringIO crypt errno
exceptions fcntl gc itertools marshal math md5 mmap operator parser
posix pyexpat select sha signal struct symbol sys termios thread time
token unicodedata zipimport zlib
array binascii cPickle cmath collections ctypes datetime functools grp
md5 pwd pyexpat sha sqlite3 syslog
ctypes
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 8 / 35
11. What works on PyPy
Pure Python modules should Just Work (TM)
django trunk
twisted, nevow
pylons
bittorrent
...
lot of standard modules
__builtin__ __pypy__ _codecs _lsprof _minimal_curses
_random _rawffi _socket _sre _weakref bz2 cStringIO crypt errno
exceptions fcntl gc itertools marshal math md5 mmap operator parser
posix pyexpat select sha signal struct symbol sys termios thread time
token unicodedata zipimport zlib
array binascii cPickle cmath collections ctypes datetime functools grp
md5 pwd pyexpat sha sqlite3 syslog
ctypes
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 8 / 35
12. What does not work on PyPy
Pure Python modules should Just Work (TM)
... unless they don’t :-)
Programs that rely on CPython-specific behavior
refcounting: open(’xxx’, ’w’).write(’stuff’)
non-string keys in dict of types (try it!)
exact naming of a list comprehension variable
exact message matching in exception catching code
...
Extension modules
really?
drum roll...
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 9 / 35
13. What does not work on PyPy
Pure Python modules should Just Work (TM)
... unless they don’t :-)
Programs that rely on CPython-specific behavior
refcounting: open(’xxx’, ’w’).write(’stuff’)
non-string keys in dict of types (try it!)
exact naming of a list comprehension variable
exact message matching in exception catching code
...
Extension modules
really?
drum roll...
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 9 / 35
14. What does not work on PyPy
Pure Python modules should Just Work (TM)
... unless they don’t :-)
Programs that rely on CPython-specific behavior
refcounting: open(’xxx’, ’w’).write(’stuff’)
non-string keys in dict of types (try it!)
exact naming of a list comprehension variable
exact message matching in exception catching code
...
Extension modules
really?
drum roll...
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 9 / 35
15. What does not work on PyPy
Pure Python modules should Just Work (TM)
... unless they don’t :-)
Programs that rely on CPython-specific behavior
refcounting: open(’xxx’, ’w’).write(’stuff’)
non-string keys in dict of types (try it!)
exact naming of a list comprehension variable
exact message matching in exception catching code
...
Extension modules
really?
drum roll...
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 9 / 35
16. What does not work on PyPy
Pure Python modules should Just Work (TM)
... unless they don’t :-)
Programs that rely on CPython-specific behavior
refcounting: open(’xxx’, ’w’).write(’stuff’)
non-string keys in dict of types (try it!)
exact naming of a list comprehension variable
exact message matching in exception catching code
...
Extension modules
really?
drum roll...
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 9 / 35
17. cpyext
CPython extension modules in PyPy
pypy-c setup.py build
still beta
not 100% of CPython API is supported
not included in PyPy 1.2
Known to work:
wxPython (after a patch)
_sre
PyCrypto
PIL
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 10 / 35
18. wxPython on PyPy (1)
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 11 / 35
19. wxPython on PyPy (2)
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 12 / 35
20. PyPy 1.2.1
Coming soon
Many bugfixes
27 issues reported after release of 1.2
beta version of cpyext
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 13 / 35
21. Part 2: Just-in-Time compilation
Snakes never crawled so fast
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 14 / 35
22. Overview of implementations
CPython
Stackless
Psyco
Jython
IronPython
PyPy (without and with JIT)
Unladen Swallow
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 15 / 35
24. Features
it just works
it may give good speed-ups (better than Psyco)
it may have a few bugs left (Psyco too)
it is not a hack (unlike Psyco)
PyPy also has excellent memory usage
half that of CPython for a program using several
hunderds MBs
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 17 / 35
25. Features
it just works
it may give good speed-ups (better than Psyco)
it may have a few bugs left (Psyco too)
it is not a hack (unlike Psyco)
PyPy also has excellent memory usage
half that of CPython for a program using several
hunderds MBs
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 17 / 35
26. Features
it just works
it may give good speed-ups (better than Psyco)
it may have a few bugs left (Psyco too)
it is not a hack (unlike Psyco)
PyPy also has excellent memory usage
half that of CPython for a program using several
hunderds MBs
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 17 / 35
27. What is a JIT
CPython compiles the program source into bytecodes
without a JIT, the bytecodes are then interpreted
with a JIT, the bytecodes are further translated to
machine code (assembler)
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 18 / 35
28. What is a JIT (2)
The translation can be:
syntactic: translate the whole functions into machine
code
“the obvious way”
e.g. Pyrex/Cython, Unladen Swallow
not good performance, or needs tricks
semantic: translate bits of the function just-in-time
only used parts
exploit runtime information (e.g. types)
Psyco, PyPy
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 19 / 35
29. What is a JIT (2)
The translation can be:
syntactic: translate the whole functions into machine
code
“the obvious way”
e.g. Pyrex/Cython, Unladen Swallow
not good performance, or needs tricks
semantic: translate bits of the function just-in-time
only used parts
exploit runtime information (e.g. types)
Psyco, PyPy
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 19 / 35
30. What is a tracing JIT
start by interpreting normally
find loops as they are executed
turn them into machine code
80% of the time is spent in 20% of the code
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 20 / 35
31. What is a tracing JIT (history)
tracing assembler (Dynamo, ~2000)
tracing Java (~2005)
tracing JavaScript (~2008)
PyPy is a “tracing JIT generator”
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 21 / 35
32. What is a tracing JIT (history)
tracing assembler (Dynamo, ~2000)
tracing Java (~2005)
tracing JavaScript (~2008)
PyPy is a “tracing JIT generator”
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 21 / 35
33. The architecture of PyPy
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 22 / 35
34. Speed of the PyPy JIT
Python programs that are, or are not, nicely handled by
the JIT:
loops, even across many calls, are nicely handled
loops with very many taken paths are not
e.g. Python programs that look like interpreters
typical in tracing JITs
bad support so far for generators and recursion
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 23 / 35
35. The optimizations we get
!= optimizations we wrote :-)
removed frame handling
local variables are in CPU registers or on the C stack
but sys._getframe() works correctly
“virtuals”: temporary objects are not constructed
e = a + b + c + d
and much more complex examples
attribute and method lookups, etc.
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 24 / 35
36. Example
def g(a, b): ADD EAX, 1
if a < 5: # 2 CMP EAX, EBX
return -1 JNL <guard 1>
return a - b # 3 CMP EAX, 0
JL <guard 2>
def f(x): MOV ECX, EAX
total = 0 SUB ECX, EBX
# 1 JO <guard 3>
for i in range(x): ADD EDX, ECX
d = g(i, x) JO <guard 4>
total += d # 4 JMP
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 25 / 35
37. Example
def g(a, b): ADD EAX, 1
if a < 5: # 2 CMP EAX, EBX
return -1 JNL <guard 1>
return a - b # 3 CMP EAX, 0
JL <guard 2>
def f(x): MOV ECX, EAX
total = 0 SUB ECX, EBX
# 1 JO <guard 3>
for i in range(x): ADD EDX, ECX
d = g(i, x) JO <guard 4>
total += d # 4 JMP
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 25 / 35
38. Practical results
fast :-)
so far, x86-32 only
relatively easy to maintain (or port to x86-64, etc.)
reminder: works transparently for any Python code
or any language (Prolog JIT :-) at PPDP 2010)
viable alternative to CPython
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 26 / 35
39. Part 3
How to use PyPy right now
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 27 / 35
40. Mandelbrot demo
Works purely on PyPy
Not always the case
missing extension modules (cpyext mitigates the
problem)
libraries that rely on CPython details
...
clear performance-critical part
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 28 / 35
41. CPython and PyPy side by side
CPython: runs the main application
PyPy: subprocess, runs only the hotspots
How do they communicate?
execnet
The Ring of Python, Holger Krekel, 9:00
oups, too late :-)
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 29 / 35
42. Rendering (1)
Mandelbrot
def render(request):
w = int(request.GET.get(’w’, 320))
h = int(request.GET.get(’h’, 240))
from py_mandel import mandelbrot
img = mandelbrot(w, h)
return HttpResponse(img, content_type="image/bmp")
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 30 / 35
43. Rendering (2)
Mandelbrot on PyPy
def pypy_render(request):
w = int(request.GET.get(’w’, 320))
h = int(request.GET.get(’h’, 240))
channel = pypy.remote_exec("""
from py_mandel import mandelbrot
w, h = channel.receive()
img = mandelbrot(w, h)
channel.send(img)
""")
channel.send((w, h))
img = channel.receive()
return HttpResponse(img, content_type="image/bmp")
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 31 / 35
44. execnet setup
At startup
import execnet
mygroup = execnet.Group()
pypy = mygroup.makegateway("popen//python=pypy-c")
pypy.remote_exec("""
import sys
import os
os.chdir("mandelbrot")
sys.path.insert(0, ’’)
""")
antocuni, arigato (Pycon Italia Qu4ttro) PyPy 1.2 May 8 2010 32 / 35