472,336 Members | 1,322 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,336 software developers and data experts.

Slow Python - what can be done?

Hey,

I'm an experience programmer but new to Python. I'm doing a simple
implementation of a field morphing techinique due to Beier and Neely
(1992) and I have the simple case working in Python 2.3 - but it's
REALLY slow.

Basically, you specify two directed line segments in the coordinate
system of a raster image and use the difference between those two
lines to transform the image.

for a 400 x 600 image, python takes about 30 seconds to run the
algorithm. This seems way to slow - I would expect it to run in a
matter of a few seconds. Here's the code: what should I do to speed
things up? I know I'm going to get a "do it in C/make a C extension"
but that defeats the purpose: I'd like to know what Python can do
here.

Thanks for your help.

from Tkinter import *
import Image
import ImageTk
from sys import exit
from math import sqrt

class Point:
# A Point in the plane
def __init__(self, int1, int2):
# Constructor
self.x = float(int1)
self.y = float(int2)
def __add__(self, other):
# Add two points
return Point(self.x + other.x, self.y + other.y)
def __sub__(self, other):
# Sub two points
return Point(self.x - other.x, self.y - other.y)
def __mul__(self, other):
# Either mult by a constant or dot product
if type(other) == float or type(other) == int:
return Point(self.x*other, self.y*other)
else:
return self.x*other.x + self.y*other.y
def __div__(self,other):
# division by a constant
if type(other) == float or type(other) == int:
return Point(self.x/other, self.y/other)
def __rmul__(self, other):
# multiplication by a constant
return Point(self.x*other, self.y*other)
def __rdiv__(self, other):
# division by a constant
return Point(other/self.x, other/self.y)
def __str__(self):
# printing represenation
return '(%s, %s)' % (self.x, self.y)
def length(self):
# regular length
return sqrt(pow(self.x, 2) + pow(self.y, 2))
def perpindicular(self):
# 90 deg rotation
return Point(self.y, -self.x)
def to_tuple(self):
# makes a tuple of ints
return (int(self.x), int(self.y))
class WarpLine:
# The lines used to warp the image
def __init__(self, x0, y0, x1, y1, id):
# Constructor - just two points - id not used yet.
self.id = 0
self.point1 = Point(x0, y0)
self.point2 = Point(x1, y1)
def __str__(self):
# Printing
return '%s->%s' % (self.point1, self.point2)
def length(self):
# Segment length
return sqrt(pow(self.point2.x-self.point1.x, 2) +
pow(self.point2.y-self.point1.y, 2))
def getUV(self, point):
# v = shortest distance of point to line
# u = the parameterization of the closest point from v
diff = (self.point2 - self.point1)
u = ((point - self.point1) * diff) / (diff * diff)

v = ((point - self.point1) * diff.perpindicular()) / sqrt(diff
* diff)

return u, v
def transformPoint(self, line, point):
# finds transform of point based on self and line
diff = (line.point2 - line.point1)
u, v = self.getUV(point)
return line.point1 + u * diff + (v * diff.perpindicular()) /
sqrt(diff * diff)

class Picture:
# A simple image class
def __init__(self, file):
# Load up an image
self.data = Image.open(file)
def in_bounds(self, pt):
# is point in our bounds?
if pt.x < 0 or pt.y < 0 or pt.x > self.data.size[0] - 1 or
pt.y > self.data.size[1] - 1:
return 0
else:
return 1
def warp(self, source, line1, line2):
# Do transformPoint on each pixel, save results
# This is the slow part of the program
dest = list(self.data.getdata())
src = source.data.getdata()
for x in range(0, self.data.size[0] - 1):
for y in range(0, self.data.size[1] - 1):
xy = line1.transformPoint(line2,
Point(x,y)).to_tuple()

if self.in_bounds(Point(xy[0], xy[1])):
dest[x + y*self.data.size[0]] = src[xy[0] +
xy[1]*self.data.size[0]]

else:
dest[x + y*self.data.size[0]] = 0

self.data.putdata(dest)
def show(self):
# show the image
root = Tk()
canvas = Canvas(root, width=self.data.size[0],
height=self.data.size[1])
canvas.pack()
photo = ImageTk.PhotoImage(self.data)
disp = canvas.create_image(0, 0, anchor=NW, image=photo)
mainloop()
Jul 18 '05 #1
16 2457
In article <48**************************@posting.google.com >, Jason wrote:
Basically, you specify two directed line segments in the coordinate
system of a raster image and use the difference between those two
lines to transform the image. # This is the slow part of the program
dest = list(self.data.getdata())
src = source.data.getdata()
for x in range(0, self.data.size[0] - 1):
for y in range(0, self.data.size[1] - 1):


"For loops" are evil ;-) Though I'm not familiar with your algorithm, you
should investigate the Numeric/numarray package, which is designed to
do lots of number crunching fast. If you can cast your problem into
good Numeric form, you'll see a speedup of a factor of hundreds.

Mike

--
Dr. Michael Ressler
Research Scientist, Astrophysics Research Element, Jet Propulsion Laboratory
Email: re*****@cheetah.jpl.nasa.gov Phone: (818)354-5576
"A bad night at the telescope is still better than the best day at the office."
Jul 18 '05 #2
On 18 Mar 2004 09:43:19 -0800, se******@rocknroll.umcs.maine.edu
(Jason) wrote:
Hey,

I'm an experience programmer but new to Python. I'm doing a simple
implementation of a field morphing techinique due to Beier and Neely
(1992) and I have the simple case working in Python 2.3 - but it's
REALLY slow.


My impression is that you should avoid the Point class. It's a pretty
trivial class, but each time it is instantiated or an instance
destroyed you get some overhead. Do that enough times and you get
speed issues. If you can live with tuples and non-member functions,
that may be some help.

Also, for the picture data itself, possibly you should look at the
numarray library. I haven't used it myself, but I suspect that it will
have lower overheads than a standard Python list.

http://www.pfdubois.com/numpy/
You also seem to be doing too much avoidable work in your inner loop.
For instance, you could swap your x and y loops, and calculate things
like y*self.data.size[0] once per row (rather than for every single
pixel). I imagine there are also aspects of the transform calculation
that could be done once per row to save time, though I haven't looked
that closely at what you are doing.
--
Steve Horne

steve at ninereeds dot fsnet dot co dot uk
Jul 18 '05 #3
"Jason" <se******@rocknroll.umcs.maine.edu> wrote in message
news:48**************************@posting.google.c om...
Hey,

I'm an experience programmer but new to Python. I'm doing a simple
implementation of a field morphing techinique due to Beier and Neely
(1992) and I have the simple case working in Python 2.3 - but it's
REALLY slow.

<code snipped>

Here's a couple of thoughts:

- Replace the implementation of WarpLine.length() from:
return sqrt(pow(self.point2.x-self.point1.x, 2) +
pow(self.point2.y-self.point1.y, 2))
to
return math.hypot( (self.point2-self.point1).to_tuple() )

If length() is called repeatedly for a given WarpLine, then cache this
value in an instance variable, and reset it if transformPoint is ever
called.

- Fire up the hotshot profiler. It will tell you which functions really
need tuning. Even though you've identified the "slow part", there are
several function calls made from this segment, any of which could be the
real hot spot.

- Look into using psyco. It is *very* non-intrusive, and you may find you
can get some major speed-up. The simplest way to get started, after
installing psyco is, at the top of your module, add:
import pysco
psyco.full()
psyco can get in the way of hotshot line profiling. But you will still get
accurate counts and timing at a function call level.

- Your Point class does a lot of type checking when multiplying or dividing
by a constant. Is this worth the penalty you are paying every time these
functions get called? Oh, wait, I see that __mul__ may be multiplying by a
constant, or doing a dot product. If hotshot tells you this is a choke
point, you might rethink using this one method for both functions. Or at
least, reduce your type() calls by changing from:
if type(other) == float or type(other) == int:
return Point(self.x*other, self.y*other)
else:
return self.x*other.x + self.y*other.y
to:
if isinstance(other, Point):
return self.x*other.x + self.y*other.y
else:
return Point(self.x*other, self.y*other)

- If you are forced to comparing types instead of using isinstance, I think
'is' would be a bit better than '=='.

- Why does Point.to_tuple() return int's, although you use floats
throughout? Since it looks like you have set up Point to be immutable, can
you keep both a float and an int member value for x and y, so you don't have
to do extra conversions? Also, since WarpLine also appears to be immutable,
you should be able to cache diff and diff*diff (maybe call it diff2 or
diffSquared) - either initialize in the __init__ method, or compute lazily
when needed.

- Experience in other languages sometimes gets in your way when using
Python. Not sure if this has any performance impact, but
Picture.in_bounds() can be made more Pythonic, as (also, double check use of
'<' vs '<='):

def in_bounds(self,pt):
return (0 <= pt.x <= self.data.size[0] and 0 <= pt.y <=
self.data.size[1])

- Another thing to get used to in Python that is unlike other languages is
the return of ordered pairs of values. Look at this code:
xy = line1.transformPoint(line2, Point(x,y)).to_tuple()

if self.in_bounds(Point(xy[0], xy[1])):
dest[x + y*self.data.size[0]] = src[xy[0] +
xy[1]*self.data.size[0]]
else:
dest[x + y*self.data.size[0]] = 0

You return a tuple, lets call it (transx, transy), representing the
transformed point, then create a new Point using the separate elements to
test for in_bounds-ness, and then access the individual pieces using [0] and
[1] accesses. Function calls are performance killers in Python, so avoid
them where possible. Try this instead:
transPt = line1.transformPoint(line2, Point(x,y))
transx, transy = transPt.to_tuple() # or even transx,
transy = transPt.x, transPt.y

if self.in_bounds(transPt):
dest[x + y*self.data.size[0]] = src[transx +
transy*self.data.size[0]]
else:
dest[x + y*self.data.size[0]] = 0

- You also reference self.data.size[0] *many* times, even though this is
invariant across all your nested loops. Store this in a local variable
before you start your outer for loop, call it something like "xsize". Then
replace every use of "self.data.size[0]" with "xsize". As an added bonus,
your code will start getting more readable.

- Your arithmetic operators can generate *lots* of temporary Point objects.
You can streamline some of this process by defining a __slots__ attribute at
the class level, listing the field names "x" and "y". This will keep Python
from allocating a dictionary for all possible attribute names and values for
every Point object created. Likewise for WarpLine.

HTH,
-- Paul
Jul 18 '05 #4
On Thu, 18 Mar 2004 09:43:19 -0800, Jason wrote:
Hey,

I'm an experience programmer but new to Python. I'm doing a simple
implementation of a field morphing techinique due to Beier and Neely
(1992) and I have the simple case working in Python 2.3 - but it's
REALLY slow.

Basically, you specify two directed line segments in the coordinate
system of a raster image and use the difference between those two
lines to transform the image.

for a 400 x 600 image, python takes about 30 seconds to run the
algorithm. This seems way to slow - I would expect it to run in a
matter of a few seconds. Here's the code: what should I do to speed
things up? I know I'm going to get a "do it in C/make a C extension"
but that defeats the purpose: I'd like to know what Python can do
here.

Thanks for your help.
[SNIP]


I can't try your prog because I have not Tkinter,
but I think this app would gain a lot in performances using psyco.
http://psyco.sourceforge.net/ <-- home
http://psyco.sourceforge.net/psycoguide/index.html <-- doc

The simplest way to use psyco is putting
import psyco
psyco.full()
after your imports.

Ciao,
Riccardo
--
-=Riccardo Galli=-

_,e.
s~ ``
~@. ideralis Programs
.. ol
`**~ http://www.sideralis.net
Jul 18 '05 #5

Jason> Here's the code: what should I do to speed things up?

Without considering your code, two suggestions come to mind. One, look at
PIL or Numeric. Perhaps one of them has a more efficient C-based Image
class or array class will will help. Two, if you're running on an Intel
Pentium-type processor (Windows or Linux), take a look at psyco.

http://www.pythonware.com/products/pil/
http://psyco.sourceforge.net/

If you don't have Intel hardware, you might consider PyInline or SciPy's
weave tool to easily inline bits of C code into your Python.

A quick look at your code suggests that you use a fair amount of abstraction
(nothing wrong with that), then throw it away:

xy = line1.transformPoint(line2, Point(x,y)).to_tuple()
if self.in_bounds(Point(xy[0], xy[1])):
...

In the above, you instantiate a Point using x and y, then pass it to
transformPoint() which returns new Point. You immediately discard that
point by calling .to_tuple(), then in the next statement create yet another
Point with those same coordinates. Why not just have transformPoint accept
a tuple and return a tuple or at least save the transformed Point for later
use?

Skip

Jul 18 '05 #6
Hello Jason,
I'm an experience programmer but new to Python. I'm doing a simple
implementation of a field morphing techinique due to Beier and Neely
(1992) and I have the simple case working in Python 2.3 - but it's
REALLY slow. Did you use hotshot to find *where* you spend the time?
class Point:
...

I've found out the Python's faster with native types.
One thing is to use a tuple for the point and have functions like
point_sub(p1, p2)

You can try and use Psyco, in several cases it gives a very big speedup.

HTH.
Miki
Jul 18 '05 #7
Thanks for the help - I wasn't aware of the profilers avilable for
Python.

My uber-abstraction is due to recently fleeing from C (abstraction
made hard) and Lisp (no workable GUI stuff) so I'm stuck in the
middle. Anyway, I appreciate the comments.

Jason
Jul 18 '05 #8
se******@rocknroll.umcs.maine.edu (Jason) wrote in message news:<48**************************@posting.google. com>...
Hey,

I'm an experience programmer but new to Python. I'm doing a simple
implementation of a field morphing techinique due to Beier and Neely
(1992) and I have the simple case working in Python 2.3 - but it's
REALLY slow.

Basically, you specify two directed line segments in the coordinate
system of a raster image and use the difference between those two
lines to transform the image.

for a 400 x 600 image, python takes about 30 seconds to run the
algorithm. This seems way to slow - I would expect it to run in a
matter of a few seconds. Here's the code: what should I do to speed
things up? I know I'm going to get a "do it in C/make a C extension"
but that defeats the purpose: I'd like to know what Python can do
here.


If you can't go with the mentioned compilers (psycho) or libraries
there is nothing else then writing C. Python is best at glueing code
together. Writing numerical or highly mathematical algorithms in
python will always result in 10000% overhead.

Maybe you want to look at GNU eiffel (smarteiffel).

Remember there is no silver bullet !
Jul 18 '05 #9
se******@rocknroll.umcs.maine.edu (Jason) writes:
Thanks for the help - I wasn't aware of the profilers avilable for
Python.


You might abuse complex numbers for points (the lisp faq recommends
doing this), maybe it speeds things up. You might even save time (I
did not try this, but hardware operations might be cheaper than Python
procedure calls) by doing complex products and ignoring the imaginary
part of the result just to get quickly at stuff like
p1.x*p2.x-p1.y*p2.y.

If you come from the lisp world anyway, you might try STk or stklos
(schemes with OO and Tk (or GTK) bindings).

Ralf
--
GS d->? s:++>+++ a+ C++++ UL+++ UH++ P++ L++ E+++ W- N++ o-- K- w--- !O M- V-
PS+>++ PE Y+>++ PGP+ !t !5 !X !R !tv b+++ DI+++ D? G+ e++++ h+ r? y?
Jul 18 '05 #10
Jason wrote:
My uber-abstraction is due to recently fleeing from C (abstraction
made hard) and Lisp (no workable GUI stuff) so I'm stuck in the
middle. Anyway, I appreciate the comments.


Not so fast. I think abstraction is *good* - only not well suited for the
inner loop of an image transformation algorithm.

Your warping seems to boil down to an affine transform, so whatever fancy
stuff you do as a preparation - with points, lines and all that nice
object-oriented stuff - you always end up with two equations

u = ax + by + c
v = dx + ey + f

and that's the only thing you should calculate repeatedly if you want
efficiency.
Using that recipe reduced calculation time for a small 350x223 pixel image
from 10 to 0.33 (0.2 with psyco) seconds. Here's the code, and I'm
confident you'll recognize it :-)

(no testing performed, but the images *do* look similar)

<warp.py>
""" call with
--psyco to use psyco
--old to use the original algorithm
an image file as the *last* parameter
"""
from Tkinter import *
import Image
import ImageTk
from sys import exit
from math import sqrt

if "--psyco" in sys.argv:
import psyco
psyco.full()

class Point:
# A Point in the plane
def __init__(self, int1, int2):
# Constructor
self.x = float(int1)
self.y = float(int2)
def __add__(self, other):
# Add two points
return Point(self.x + other.x, self.y + other.y)
def __sub__(self, other):
# Sub two points
return Point(self.x - other.x, self.y - other.y)
def __mul__(self, other):
# Either mult by a constant or dot product
if type(other) == float or type(other) == int:
return Point(self.x*other, self.y*other)
else:
return self.x*other.x + self.y*other.y
def __div__(self,other):
# division by a constant
if type(other) == float or type(other) == int:
return Point(self.x/other, self.y/other)
def __rmul__(self, other):
# multiplication by a constant
return Point(self.x*other, self.y*other)
def __rdiv__(self, other):
# division by a constant
return Point(other/self.x, other/self.y)
def __str__(self):
# printing represenation
return '(%s, %s)' % (self.x, self.y)
def length(self):
# regular length
return sqrt(pow(self.x, 2) + pow(self.y, 2))
def perpindicular(self):
# 90 deg rotation
return Point(self.y, -self.x)
def to_tuple(self):
# makes a tuple of ints
return (int(self.x), int(self.y))
class WarpLine:
# The lines used to warp the image
def __init__(self, x0, y0, x1, y1, id):
# Constructor - just two points - id not used yet.
self.id = 0
self.point1 = Point(x0, y0)
self.point2 = Point(x1, y1)
def __str__(self):
# Printing
return '%s->%s' % (self.point1, self.point2)
def length(self):
# Segment length
return sqrt(pow(self.point2.x-self.point1.x, 2) +
pow(self.point2.y-self.point1.y, 2))
def getUV(self, point):
# v = shortest distance of point to line
# u = the parameterization of the closest point from v
diff = (self.point2 - self.point1)
u = ((point - self.point1) * diff) / (diff * diff)

v = ((point - self.point1) * diff.perpindicular()) / sqrt(diff *
diff)

return u, v
def transformPoint(self, line, point):
# finds transform of point based on self and line
diff = (line.point2 - line.point1)
u, v = self.getUV(point)
return line.point1 + u * diff + (v * diff.perpindicular())
/sqrt(diff * diff)

class Picture:
# A simple image class
def __init__(self, file):
# Load up an image
self.data = Image.open(file)
def in_bounds(self, pt):
# is point in our bounds?
if pt.x < 0 or pt.y < 0 or pt.x > self.data.size[0] - 1 or pt.y >
self.data.size[1] - 1:
return 0
else:
return 1

def coefficients(self, transform=None):
orig = transform(Point(0, 0))
p = transform(Point(1, 0)) - orig
q = transform(Point(0, 1)) - orig
a, b, c = p.x, q.x, orig.x
d, e, f = p.y, q.y, orig.y
return a, b, c, d, e, f

def warp_new(self, source, line1, line2):
""" psyco doesn't like lambdas, so I had to factor it out.
Does anybody know why?
"""
self._warp(source,
*self.coefficients(lambda p: line1.transformPoint(line2, p)))

def _warp(self, source, a, b, c, d, e, f):
width, height = self.data.size
dest = [0] * (width*height)
src = source.data.getdata()
yoff = 0
for y in range(height):
for x in range(width):
u = int(a*x+b*y+c)
v = int(d*x+e*y+f)
if u >= 0 and u < width and v >= 0 and v < height:
dest[x + yoff] = src[u + v*width]
yoff += width
self.data.putdata(dest)

def warp_old(self, source, line1, line2):
# Do transformPoint on each pixel, save results
# This is the slow part of the program
dest = list(self.data.getdata())
src = source.data.getdata()
for x in range(0, self.data.size[0] - 1):
for y in range(0, self.data.size[1] - 1):
xy = line1.transformPoint(line2,Point(x,y)).to_tuple()

if self.in_bounds(Point(xy[0], xy[1])):
dest[x + y*self.data.size[0]] = src[xy[0] +
xy[1]*self.data.size[0]]

else:
dest[x + y*self.data.size[0]] = 0

self.data.putdata(dest)
def show(self):
# show the image
root = Tk()
canvas = Canvas(root,
width=self.data.size[0],height=self.data.size[1])
canvas.pack()
photo = ImageTk.PhotoImage(self.data)
disp = canvas.create_image(0, 0, anchor=NW, image=photo)
mainloop()

if __name__ == "__main__":
import time
p1 = Picture(sys.argv[-1])
line1 = WarpLine(0, 0, 200, 50, None)
line2 = WarpLine(-100, 0, 150, 0, None)
start = time.time()
if "--old" in sys.argv:
p1.warp_old(p1, line1, line2)
else:
p1.warp_new(p1, line1, line2)
print time.time() - start
p1.show()
</warp.py>

I'm sure there's room for improvement. E. g., you could devise a clipping
algorithm to not calculate all the black points. By the way, the Python
Imaging Library (PIL) has such a transform built in - but that might spoil
the fun.

Peter

Jul 18 '05 #11
It's affine for the one-line-pair case, but the full algorithm actually
uses n line pairs to describe a nonlinear transformation. Since the
transformations are weighted for each pair, the matrix solution doesn't
cut it for the general case.

Of course, since I didn't mention it, you wouldn't have known that - sorry.

It should be obvious now why I want the speed tho - doing that
transformation n times and then adding in some extra sums and a division
will only make things slower.

Jason
Jul 18 '05 #12
Jason Sewall wrote:
It's affine for the one-line-pair case, but the full algorithm actually
uses n line pairs to describe a nonlinear transformation. Since the
Would you care to post a small driver program (if feasible)? I'd like to try
the "complex numbers as points" approach on it.
transformations are weighted for each pair, the matrix solution doesn't
cut it for the general case.

Of course, since I didn't mention it, you wouldn't have known that -
sorry.


No problem.

Peter
Jul 18 '05 #13
Riccardo Galli wrote:
I can't try your prog because I have not Tkinter,


Isn't Tkinter a standard module?
Jul 18 '05 #14
I was out of town for a few days and thus had to rely on Google's only
okay support for news. When I get a moment, I'll be working on a
real-deal version of the algorithm and worry about optimization.

I understand your suggestion about the complex number. It's probably a
good idea and it is reminiscent of quaternions (although in the plane).

I'll let you know,

Jason

Peter Otten wrote:
Jason Sewall wrote:

It's affine for the one-line-pair case, but the full algorithm actually
uses n line pairs to describe a nonlinear transformation. Since the

Would you care to post a small driver program (if feasible)? I'd like to try
the "complex numbers as points" approach on it.

transformations are weighted for each pair, the matrix solution doesn't
cut it for the general case.

Of course, since I didn't mention it, you wouldn't have known that -
sorry.

No problem.

Peter

Jul 18 '05 #15
Jason wrote:
Hey,

I'm an experience programmer but new to Python. I'm doing a simple
implementation of a field morphing techinique due to Beier and Neely
(1992) and I have the simple case working in Python 2.3 - but it's
REALLY slow.
That's ok.
Basically, you specify two directed line segments in the coordinate
system of a raster image and use the difference between those two
lines to transform the image.

for a 400 x 600 image, python takes about 30 seconds to run the
algorithm. This seems way to slow - I would expect it to run in a
matter of a few seconds. Here's the code: what should I do to speed
things up? I know I'm going to get a "do it in C/make a C extension"
but that defeats the purpose: I'd like to know what Python can do
here.


Well, I am on this least for years now, and I know most
of the answers in advance (and most have been here),
so I'm not adding new stuff how to optimize this.

Although in fact your inner point class raises the expenses
considerably.

If you need a fast algorithm right now, you need to change
your program, probably by writing or using C extensions.

This has always been the flip side of Python: When the real
fun begins, Python is too slow. It is great on everything
but speed. Advice then mostly concentrates on how to make
you using something else for the time critical code.

This is what we will solve by the PyPy project. We are besides
other things automating a way to analyse and optimize Python
programs for C-like speed. The advantage is that you can stick
with your Python program. It will just be very fast, compared
to, say, C. (We don't know yet *how exactly* this will compare :-)

So, if you have the time, wait for two years. Or use Psyco, and
rewrite your Points to use simple Tuples, or use NumPy.
But please keep a copy of your initial approach.
I would be very interested to see how this compares when
we have the first results from our PyPy project.

cheers - chris

--
Christian Tismer :^) <mailto:ti****@stackless.com>
Mission Impossible 5oftware : Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a : *Starship* http://starship.python.net/
14109 Berlin : PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34 home +49 30 802 86 56 mobile +49 173 24 18 776
PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04
whom do you want to sponsor today? http://www.stackless.com/
Jul 18 '05 #16
What I am used to is how you can declare variables in Common Lisp to be
static; when you are done building your system, you can then go through
and optimize for speed.

Then again, Lisp is a very industrial language with plenty of experience
and development under its belt - python is fairly new.

Still, I am impressed by Pythons abstraction and libraries. I'm going to
look into different ways of speeding up my code through general
optimization and perhaps some C code.

Thanks again for your help, all.

Jason
Jul 18 '05 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Rami Saarinen | last post by:
I have been making a client-server type of software mainly on Linux and now I am trying to get it all work also on windows. However, I am having...
5
by: Michael Mossey | last post by:
Runnng python 2.2 on HP-UX, I get intermittant slow startup. Sometimes python starts up in a small fraction of a second, and sometimes takes 3-5...
1
by: iviskic | last post by:
Hi, I'm doing an analysis of program code performance when written in python as oppose to other programming languages, and can't seem to figure...
0
by: wout | last post by:
Hi there, I am fairly new to python, the problem is as follows: newnodes = {} for i in nodes: newnodes = i.coordinate is very slow, which...
50
by: diffuser78 | last post by:
I have just started to learn python. Some said that its slow. Can somebody pin point the issue. Thans
3
by: chrisperkins99 | last post by:
It seems to me that str.count is awfully slow. Is there some reason for this? Evidence: ######## str.count time test ######## import string...
25
by: jwrweatherley | last post by:
I'm pretty new to python, but am very happy with it. As well as using it at work I've been using it to solve various puzzles on the Project Euler...
57
by: dongie.agnir | last post by:
I'm pretty new to Python, and even newer to Image/Video processing, and trying to get started on a project similar to GRL Vienna's laser marker. I...
39
by: cm_gui | last post by:
Python is slow. Almost all of the web applications written in Python are slow. Zope/Plone is slow, sloow, so very slooow. Even Google Apps is...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.