I almost wrote a long reply to all this.
In the end it boils down to being concerned about how much overhead
there is to calling a 'C' function.
I assumed that file.seek() simply delegated to fseek() and thus was
one way to test this overhead.
However, I now think that it must be doing more and may
I just tried the seek test with Cython.
Cython fseek() : 1.059 seconds. 30% slower than 'C'
Python f.seek : 1.458 secondds. 80% slower than 'C'.
It is amazing to me that Cython generates a 'C' file that is 1478
lines.
#Cython code
import time
cdef int SEEK_SET = 0
cdef extern from "stdio.h"
I am assuming that Python delegates the f.seek call to the seek call
in the MS C runtime library msvcrt.dll.
Does anybody know a nice link to the Python source like was posted
above for the BSD 'C' library?
Ok, I ran some more tests.
C, seek: 0.812 seconds // test from original post
Thanks, Tim.
Good to know.
--
http://mail.python.org/mailman/listinfo/python-list
f1_seek = f1.seek did not change the performance at all.
As it turns out each call is only
646 nanoseconds slower than 'C'.
However, that is still 80% of the time to perform a file seek,
which I would think is a relatively slow operation compared to just
making a system call.
--
http://mail.python
I ran a comparison that timed 1e6 file seeks.
The tests were run with Python 2.6.4 and Microsoft Visual C 6.0 on
Windows XP with an Intel 3GHz single processor with hyperthreading.
Results:
C: 0.812 seconds
Python: 1.458 seconds.
difference = 0.646 seconds.
If the file.seek is removed the
Well, I just realized that I could use a separate pipe to send the
result back. This might work ok.
--
http://mail.python.org/mailman/listinfo/python-list
I wanted to use Multiprocessing.Pipe and Multiprocessing.Process to
peform Actor style communication.
However, I just can't get what I need done, and I think it is due to
inherit problems with the design of Pipe.
If I have a process like this
def process1(conn):
while True:
msg = conn.
>From the documentation for Using a remote manager there is the
following example code:
from multiprocessing.managers import BaseManager
import Queue
queue = Queue.Queue()
class QueueManager(BaseManager): pass
QueueManager.register('get_queue', callable=lambda:queue)
m = QueueManager(address=('',
The following code snippet is taken from the Python 2.6
multiprocessing documentation with a simple change and this change
does not work. I would like to know how to make it work or something
similar.
I want to pass a Connection object to the MathsClass.
I get the following error on Windows:
Trac
Thanks to all, I learned something in each post.
When using py2exe to build an executable sys.executable does not
provide the name of the python interpreter but the name of the
executable generated by py2exe.
--
http://mail.python.org/mailman/listinfo/python-list
In particular I want to know how to tell if reading and writing to the
console can occur.
Something like
sys.isConsolePresent()
--
http://mail.python.org/mailman/listinfo/python-list
Slight correction.
" %d" % 123 is not quite equivalent to str(123) as it does not handle
negative numbers the same way.
I am not sure there is a simple direct equivalent.
"%+d" % 123 --> "+123" always gives a sign.
"%4d" % 123 --> " 123"
"%4d" % -123 --> "-123" so this works if you you know how wi
Ok, I see what I did wrong.
I forgot to define the _fields_ variable.
--
http://mail.python.org/mailman/listinfo/python-list
A.M wrote:
> Hi,
>
>
>
> I am trying to find the equivalent functions such as vb's str or asc in
> Python. Is there any resource that help me to find these kinds of functions
> in Python faster?
>
>
>
> Thank you,
>
> Alan
>
> Alan
Python has a str() function that is close to vb's str. The Pyth
I would like to call
windll.user32.SendMessageA(hwnd, win32con.WM_COMMAND, wParam, lParam)
where
lParam represents a pointer to an object.
And also convert this pointer back to an object reference inside of
wnd_proc
def wnd_proc(hwnd, msg, wParam, lParam):
So something like this:
class X(Structur
Thanks everybody.
--
http://mail.python.org/mailman/listinfo/python-list
I have a question about the interactive Python shell. Is it possible
to reload a file and get the new definitions.
For example, if I do
import xyz
Then I find a bug in some function in xyz.
So, I edit xyz.py
I would like to reload the definitions in xyz.py without leaving my
current shell sessi
This example is missing a few initialization details although they can
possibly be inferred.
For example is
iq = imageQueue()
but imageQueue does not have a put() method.
Is SetQueue() called?
Is iq.start() called?
I like to see small, fully complete and tested examples.
The following works using
19 matches
Mail list logo