Re: execution timing of the method QWidget.show()

2020-07-08 Thread Barry
Search for PyQt mailing list will get you to https://www.riverbankcomputing.com/mailman/listinfo/pyqt Barry > On 8 Jul 2020, at 21:17, artis.pain...@gmail.com wrote: > > I might be wrong but since I have not found anygroup newsgroup dedicated to > PyQt5. > > My small program is expected to s

Re: execution timing of the method QWidget.show()

2020-07-08 Thread MRAB
On 2020-07-08 21:11, artis.pain...@gmail.com wrote: I might be wrong but since I have not found anygroup newsgroup dedicated to PyQt5. My small program is expected to show a window GUI for 4 seconds before changing it, so I naively coded: "... ... # codes to set up the GUI ... F0.show() # F0

execution timing of the method QWidget.show()

2020-07-08 Thread artis . paintre
I might be wrong but since I have not found anygroup newsgroup dedicated to PyQt5. My small program is expected to show a window GUI for 4 seconds before changing it, so I naively coded: "... ... # codes to set up the GUI ... F0.show() # F0 being a QMainWindow object time.sleep(4) ... # codes t

Re: Timing problem?

2019-03-21 Thread Chris Angelico
On Fri, Mar 22, 2019 at 1:01 AM Steve wrote: > > I believe I can see what is happening here but maybe someone can explain > least I run into this again. > > Situation 1: I am using "ws.MessageBeep(1)" to generate a tone through the > speakers. I wanted two tones to separate it from other tones t

Timing problem?

2019-03-21 Thread Steve
I believe I can see what is happening here but maybe someone can explain least I run into this again. Situation 1: I am using "ws.MessageBeep(1)" to generate a tone through the speakers. I wanted two tones to separate it from other tones that might happen and placed that code a second time in t

MIDI note timing

2018-09-18 Thread Tobiah
I'd like to do some algorithmic composing using python. I've seen various libraries that seem to be capable of sending a MIDI message to a MIDI port, but I don't know where to get the timing from. Normally, with something like CSOUND, the program locks itself to the timing of th

Midi output timing?

2017-09-07 Thread Tobiah
I'd like to use a python program to send out MIDI events to another program. I've done in the past by generating scores for csound which would do the MIDI output. The apparent hurdle is the timing bit. I've seen packages that allow the creation of MIDI events, but given a li

Re: timing issue: shutil.rmtree and os.makedirs

2013-07-30 Thread Göktuğ Kayaalp
On Jul 30, 2013 3:29 PM, "Chris Angelico" wrote: > > On Tue, Jul 30, 2013 at 2:10 PM, Tim wrote: > > hmm, now that you mention it, this is executing on a remote box with access to the same file system my local calling program is on. That is, there is a local call to an intermediate script that co

Re: timing issue: shutil.rmtree and os.makedirs

2013-07-30 Thread Chris Angelico
On Tue, Jul 30, 2013 at 4:37 PM, Tim wrote: > Argg, this isn't the first time I've had troubles with the file system. This > is FreeBSD and NFS. I will code up a progressive delay as you mentioned (with > Steve's correction). I've used several different networked file systems, including NetBIOS

Re: timing issue: shutil.rmtree and os.makedirs

2013-07-30 Thread Tim
On Tuesday, July 30, 2013 9:27:10 AM UTC-4, Chris Angelico wrote: > On Tue, Jul 30, 2013 at 2:10 PM, Tim wrote: > > hmm, now that you mention it, this is executing on a remote box with access > > to the same file system my local calling program is on. That is, there is a > > local call to an inte

Re: timing issue: shutil.rmtree and os.makedirs

2013-07-30 Thread Chris Angelico
On Tue, Jul 30, 2013 at 3:07 PM, Steven D'Aprano wrote: > On Tue, 30 Jul 2013 14:27:10 +0100, Chris Angelico wrote: > >> for delay in 100,300,600,1000,3000,5000,1: >> if not os.path.exists(directory): break >> sleep(delay) >> >> That'll sleep a maximum of 20 seconds, tune as required. > >

Re: timing issue: shutil.rmtree and os.makedirs

2013-07-30 Thread Steven D'Aprano
On Tue, 30 Jul 2013 14:27:10 +0100, Chris Angelico wrote: > for delay in 100,300,600,1000,3000,5000,1: > if not os.path.exists(directory): break > sleep(delay) > > That'll sleep a maximum of 20 seconds, tune as required. Actually, that will sleep a maximum of 5.55 hours, and a minimum of

Re: timing issue: shutil.rmtree and os.makedirs

2013-07-30 Thread Chris Angelico
On Tue, Jul 30, 2013 at 2:10 PM, Tim wrote: > hmm, now that you mention it, this is executing on a remote box with access > to the same file system my local calling program is on. That is, there is a > local call to an intermediate script that connects to a socket on the remote > where the abov

Re: timing issue: shutil.rmtree and os.makedirs

2013-07-30 Thread Tim
will be > raised as exceptions (since you haven't told it to suppress or handle > them), but possibly there's an error that it isn't able to detect. > Worth a test, anyhow. > > ChrisA Thanks Chris, but the directory was actually removed on the first run in spite

Re: timing issue: shutil.rmtree and os.makedirs

2013-07-29 Thread Chris Angelico
On Mon, Jul 29, 2013 at 8:16 PM, Tim wrote: > My intent is to pass it a directory name or path and if it exists, use > shutil.rmtree to remove whatever is there (if it isn't a directory, try to > unlink it); then use os.makedirs to create a new directory or path: > > def make_clean_dir(directory

timing issue: shutil.rmtree and os.makedirs

2013-07-29 Thread Tim
I have the following function (Python2.7 on FreeBSD) that results in an OSError. My intent is to pass it a directory name or path and if it exists, use shutil.rmtree to remove whatever is there (if it isn't a directory, try to unlink it); then use os.makedirs to create a new directory or path:

Re: Timing of string membership (was Re: hex dump w/ or w/out utf-8 chars)

2013-07-14 Thread Chris Angelico
On Mon, Jul 15, 2013 at 2:18 PM, Terry Reedy wrote: > On 7/14/2013 10:56 AM, Chris Angelico wrote: > As issue about finding stings in strings was opened last September and, as > reported on this list, fixes were applied about last March. As I remember, > some but not all of the optimizations were

Re: Timing of string membership (was Re: hex dump w/ or w/out utf-8 chars)

2013-07-14 Thread Terry Reedy
On 7/14/2013 10:56 AM, Chris Angelico wrote: On Sun, Jul 14, 2013 at 11:44 PM, wrote: timeit.repeat("a = 'hundred'; 'x' in a") [0.11785943134991479, 0.09850454944486256, 0.09761604599423179] timeit.repeat("a = 'hundreœ'; 'x' in a") [0.23955250303158593, 0.2195812612416752, 0.2213389699740

Timing of string membership (was Re: hex dump w/ or w/out utf-8 chars)

2013-07-14 Thread Chris Angelico
On Sun, Jul 14, 2013 at 11:44 PM, wrote: > Le dimanche 14 juillet 2013 12:44:12 UTC+2, Steven D'Aprano a écrit : >> On Sun, 14 Jul 2013 01:20:33 -0700, wxjmfauth wrote: >> >> >> >> > For a very simple reason, the latin-1 block: considered and accepted >> >> > today as beeing a Unicode design mist

Re: Installation of yappi (timing module)

2012-08-25 Thread Virgil Stokes
On 24-Aug-2012 12:28, Virgil Stokes wrote: I have been doing some experiments with different modules for the timing of functions and code segments. One module I would like to test is yappi (thread aware timer) which is listed at PyPI. However, I have been unable to install it on Windows Vista

Installation of yappi (timing module)

2012-08-24 Thread Virgil Stokes
I have been doing some experiments with different modules for the timing of functions and code segments. One module I would like to test is yappi (thread aware timer) which is listed at PyPI. However, I have been unable to install it on Windows Vista and Windows 7 (Python 2.7 on both). I have

Re: Spacing and timing for comparing algorithms and data-structures

2012-03-01 Thread Chris Rebert
On Thu, Mar 1, 2012 at 8:55 PM, Alec Taylor wrote: > What would you recommend I use to compare data-structures and > algorithms on space and time? (runtime) For the latter metric, one of the profiling modules: http://docs.python.org/library/debug.html I'd start with timeit and go from there: http

Spacing and timing for comparing algorithms and data-structures

2012-03-01 Thread Alec Taylor
What would you recommend I use to compare data-structures and algorithms on space and time? (runtime) Thanks for all suggestions, Alec Taylor -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparisons of computation timing

2011-09-16 Thread Nizamov Shawkat
> About the codes: Basically it simply solves some non-linear equations > using "fsolve" along with some other calculations. > Looks like you are using some third party libraries like numpy/scipy. Do these libraries have the same version on both platforms? What about python interpreter versions -

Re: Comparisons of computation timing

2011-09-16 Thread Steven D'Aprano
Akand Islam wrote: > I have run my codes (written in Python) in my Notebook (3 GB Ram, Dual- > core CPU T4500 @ 2.3 GHz) and in my lab machine (11.57 GB Ram, i7-920 > CPU @ 2.67 GHz). However, I have found execution time in Notebook > 250.3 seconds, and in Lab machine 333.2 seconds. How is it poss

Comparisons of computation timing

2011-09-15 Thread Akand Islam
I have run my codes (written in Python) in my Notebook (3 GB Ram, Dual- core CPU T4500 @ 2.3 GHz) and in my lab machine (11.57 GB Ram, i7-920 CPU @ 2.67 GHz). However, I have found execution time in Notebook 250.3 seconds, and in Lab machine 333.2 seconds. How is it possible? Good configuration mac

Re: List comprehension timing difference.

2011-09-02 Thread Bart Kastermans
t...@thsu.org writes: > On Sep 2, 9:54 am, Bart Kastermans wrote: >> if d(a,b) == 1 and a < b: > > It will probably be faster if you reverse the evaluation order of that > expression. > > if a > That way the d() function is called less than half the time. Of course > this assumes that a that's tr

Re: List comprehension timing difference.

2011-09-02 Thread ting
On Sep 2, 9:54 am, Bart Kastermans wrote: > if d(a,b) == 1 and a < b: It will probably be faster if you reverse the evaluation order of that expression. if ahttp://mail.python.org/mailman/listinfo/python-list

Re: List comprehension timing difference.

2011-09-02 Thread Bart Kastermans
MRAB writes: > On 02/09/2011 01:35, Bart Kastermans wrote: >> graph = [[a,b] for a in data for b in data if d(a,b) ==1 and a< b] >> graph2 = [] >> for i in range (0, len(data)): >> for j in range(0,len(data)): >> if d(data[i],data[j]) == 1 and i< j: >> graph2.append

Re: List comprehension timing difference.

2011-09-01 Thread MRAB
, the list comprehension is faster though (281 seconds VS 305 seconds on my dell mini). Is the right interpretation of this timing difference that the comprehension is performed in the lower level C code? As this time I have no other conjecture about the cause

List comprehension timing difference.

2011-09-01 Thread Bart Kastermans
(281 seconds VS 305 seconds on my dell mini). Is the right interpretation of this timing difference that the comprehension is performed in the lower level C code? As this time I have no other conjecture about the cause. - import time import

Re: multiprocessing timing issue

2011-08-11 Thread Tim Arnold
On 8/10/2011 11:36 PM, Philip Semanchuk wrote: On Aug 9, 2011, at 1:07 PM, Tim Arnold wrote: Hi, I'm having problems with an empty Queue using multiprocessing. The task: I have a bunch of chapters that I want to gather data on individually and then update a report database with the results.

Re: multiprocessing timing issue

2011-08-10 Thread Tim Roberts
Tim Arnold wrote: > >The task: >I have a bunch of chapters that I want to gather data on individually >and then update a report database with the results. >I'm using multiprocessing to do the data-gathering simultaneously. > >Each chapter report gets put on a Queue in their separate processes. >

Re: multiprocessing timing issue

2011-08-10 Thread Philip Semanchuk
On Aug 9, 2011, at 1:07 PM, Tim Arnold wrote: > Hi, I'm having problems with an empty Queue using multiprocessing. > > The task: > I have a bunch of chapters that I want to gather data on individually and > then update a report database with the results. > I'm using multiprocessing to do the da

multiprocessing timing issue

2011-08-09 Thread Tim Arnold
Hi, I'm having problems with an empty Queue using multiprocessing. The task: I have a bunch of chapters that I want to gather data on individually and then update a report database with the results. I'm using multiprocessing to do the data-gathering simultaneously. Each chapter report gets put

wxpython 2.8 -- timing and latency issues when displaying widgets

2010-10-28 Thread Josef Frank
Dear all, in an application window (subwindow of a Notebook-control) I'm trying to do the following: 1. Create a StaticText control kind of "Please wait until processing has finished" 2. Do some processing (e.g. vacuuming an sqlite database) 3. Create a 2nd StaticText control with the messa

Re: timing

2010-07-19 Thread Alex A.
You could use pycallgraph module Regards, Alex Abushkevich -- http://mail.python.org/mailman/listinfo/python-list

Re: timing

2010-07-16 Thread Jia Hu
Thank you, it is so straightforward. On Fri, Jul 16, 2010 at 9:58 PM, Chris Rebert wrote: > On Fri, Jul 16, 2010 at 5:52 PM, Jia Hu wrote: > > Hello: > > > > If I want to calculate the runtime of a section of a program. How can I > do > > it? > > Taking you extremely literally: > from time impo

Re: timing

2010-07-16 Thread Chris Rebert
On Fri, Jul 16, 2010 at 5:52 PM, Jia Hu wrote: > Hello: > > If I want to calculate the runtime of a section of a program. How can I do > it? Taking you extremely literally: from time import time start = time() run_section_here() end = time() runtime = end-start Assuming you're doing this in orde

timing

2010-07-16 Thread Jia Hu
Hello: If I want to calculate the runtime of a section of a program. How can I do it? Thank you, Jia -- http://mail.python.org/mailman/listinfo/python-list

Socket packet timing on Windows 2000

2009-06-11 Thread sanyi jiang
hi *Tim Janick,* I encountered same problem, did you ever get some resolution? Brent Jiang, -- http://mail.python.org/mailman/listinfo/python-list

Re: Managing timing in Python calls

2008-12-17 Thread Ross
Interesting stuff - I hadn't come across the 'with' syntax before, so I've learned something already. I was briefly excited to learn about the callLater command which is just a convenience class for the wxTimer class. It seems to be pretty much a parallel of the var t = window.setTimeout( f

Re: Python music sequencer timing problems

2008-12-16 Thread John O'Hagan
or example), which from the sound of > it also applies to your requirement - IOW, you _can_ use it just to start > notes at the right time, because the note-playing loop sleeps till then. > And as I realized after having a good sleep myself, this is only useful for timing events which occur s

Re: Managing timing in Python calls

2008-12-15 Thread cmdrrickhun...@yaho.com
I believe WxTimerEvent is handled using the event queue, which isn't going to do what you want. An event which goes through the queue does not get processed until you return to the queue. What you want to do is actually a rather difficult task to do generically. Should the task be interrupted im

Re: Managing timing in Python calls

2008-12-15 Thread Ross
bieff...@gmail.com wrote: Python has in its standard library a timer class which actually is implemented as a thread (I think) ... however, when using a GUI package, I think it is better to use gui- specific functions for event-driven programming, to make sure that your code do not mess with GUI

Re: Managing timing in Python calls

2008-12-15 Thread bieffe62
On 15 Dic, 16:21, Ross wrote: > I'm porting some ugly javascript managed stuff to have an equivalent > behaviour in a standalone app. It uses events that arrive from a server, > and various small images.  In this standalone version, the data is local > in a file and the images in a local directory

Managing timing in Python calls

2008-12-15 Thread Ross
I'm porting some ugly javascript managed stuff to have an equivalent behaviour in a standalone app. It uses events that arrive from a server, and various small images. In this standalone version, the data is local in a file and the images in a local directory. My AJAX code managed a timely

Re: Python music sequencer timing problems

2008-12-14 Thread John O'Hagan
On Sun, 14 Dec 2008, Bad Mutha Hubbard wrote: > John O'Hagan wrote: > > On Wed, 10 Dec 2008, badmuthahubbard wrote: [...] > > from time import time, sleep > > > > start = time() > > for event in music: > > duration=len(event) #Really, the length of the event > > play(event) > > while 1:

Re: Python music sequencer timing problems

2008-12-14 Thread Bad Mutha Hubbard
John O'Hagan wrote: > On Wed, 10 Dec 2008, badmuthahubbard wrote: >> I've been trying to get the timing right for a music sequencer using >> Tkinter. First I just loaded the Csound API module and ran a Csound >> engine in its own performance thread. The

Re: Python music sequencer timing problems

2008-12-10 Thread John O'Hagan
On Wed, 10 Dec 2008, badmuthahubbard wrote: > I've been trying to get the timing right for a music sequencer using > Tkinter. First I just loaded the Csound API module and ran a Csound > engine in its own performance thread. The score timing was good, > being controlled internal

Python music sequencer timing problems

2008-12-10 Thread badmuthahubbard
I've been trying to get the timing right for a music sequencer using Tkinter. First I just loaded the Csound API module and ran a Csound engine in its own performance thread. The score timing was good, being controlled internally by Csound, but any time I moved the mouse I got audio dropout

Re: Interesting timing issue I noticed

2008-04-16 Thread Dan Upton
On Wed, Apr 16, 2008 at 2:54 PM, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Wed, 16 Apr 2008 10:36:14 -0300, Jonathan Shao <[EMAIL PROTECTED]> > escribió: > > *Gabriel Genellina* gagsl-py2 at yahoo.com.ar > > > > > *Wed Apr 16 08:44:10 CEST 2008* > > >> Another thing would be to rearra

Re: Interesting timing issue I noticed

2008-04-16 Thread Gabriel Genellina
En Wed, 16 Apr 2008 10:36:14 -0300, Jonathan Shao <[EMAIL PROTECTED]> escribió: > *Gabriel Genellina* gagsl-py2 at yahoo.com.ar > > *Wed Apr 16 08:44:10 CEST 2008* >> Another thing would be to rearrange the loops so the outer one executes > less times; if you know that borderX< better to swap th

Interesting timing issue I noticed

2008-04-16 Thread Jonathan Shao
*Gabriel Genellina* gagsl-py2 at yahoo.com.ar *Wed Apr 16 08:44:10 CEST 2008* > Another thing would be to rearrange the loops so the outer one executes less times; if you know that borderX<-- http://mail.python.org/mailman/listinfo/python-list

Re: Interesting timing issue I noticed

2008-04-15 Thread Gabriel Genellina
En Tue, 15 Apr 2008 23:24:01 -0300, Jonathan Shao <[EMAIL PROTECTED]> escribió: > I've written up a stripped down version of the code. I apologize for the > bad > coding; I am in a bit of a hurry. First things first: I think you will gain inmensely using NumPy: http://numpy.scipy.org/ My t

Re: Interesting timing issue I noticed

2008-04-15 Thread Daniel Fetchinson
> time two outside = 0.125 > > > > >>> RESTART > > > > > > > > >>> > > > > time one inside = 0.078686646 > > > > time one outside = 0.125 > &g

Re: Interesting timing issue I noticed

2008-04-15 Thread Daniel Fetchinson
078686646 > > > time two outside = 0.125 > > > >>> RESTART > > > ==== > > > >>> > > > time one inside = 0.062362396 > > > time one outside = 0.155999898911 > &

Re: Interesting timing issue I noticed

2008-04-15 Thread Daniel Fetchinson
0.125 > >>> RESTART > > >>> > time one inside = 0.078686646 > time one outside = 0.17103815 > time two inside = 0.077999830246 > time two outside = 0.125 > >>> ===

Re: Interesting timing issue I noticed

2008-04-15 Thread Jonathan Shao
I've written up a stripped down version of the code. I apologize for the bad coding; I am in a bit of a hurry. import random import sys import time sizeX = 320 sizeY = 240 borderX = 20 borderY = 20 # generates a zero matrix def generate_zero(): matrix = [[0 for y in range(sizeY)] for x in ra

Re: Interesting timing issue I noticed

2008-04-14 Thread Daniel Fetchinson
> The project I'm working on is motion detection, involving a bit of image > processing. No worries: no image processing background needed. > > Suffice to say that I initially wrote a script that goes through every pixel > of a 320x240 picture (turned into an array using PIL) and performs some > ca

Interesting timing issue I noticed

2008-04-14 Thread Jonathan Shao
The project I'm working on is motion detection, involving a bit of image processing. No worries: no image processing background needed. Suffice to say that I initially wrote a script that goes through every pixel of a 320x240 picture (turned into an array using PIL) and performs some calculatiosn.

Re: Unexpected timing results with file I/O

2008-02-04 Thread Marc 'BlackJack' Rintsch
On Mon, 04 Feb 2008 21:58:46 +, Steven D'Aprano wrote: > On Mon, 04 Feb 2008 17:08:02 +, Marc 'BlackJack' Rintsch wrote: > >>> Surprisingly, Method 2 is a smidgen faster, by about half a second over >>> 500,000 open-write-close cycles. It's not much faster, but it's >>> consistent, over m

Re: Unexpected timing results with file I/O

2008-02-04 Thread Steven D'Aprano
On Mon, 04 Feb 2008 17:08:02 +, Marc 'BlackJack' Rintsch wrote: >> Surprisingly, Method 2 is a smidgen faster, by about half a second over >> 500,000 open-write-close cycles. It's not much faster, but it's >> consistent, over many tests, changing many of the parameters (e.g. the >> number of f

Re: Unexpected timing results with file I/O

2008-02-04 Thread Marc 'BlackJack' Rintsch
s are done at the same time. That's what I meant by people > going through the doors. Maybe it was more clear in my head. But my timing shows that method two is slower on my computer. So there is no obvious winner. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: Unexpected timing results with file I/O

2008-02-04 Thread rdahlstrom
It doesn't matter how many doors opening and closing there are, it matters the order in which the opening, walking through, and closing are done. That's my point. In the second example, all of the disk operations are done at the same time. That's what I meant by people going through the doors.

Re: Unexpected timing results with file I/O

2008-02-04 Thread Marc 'BlackJack' Rintsch
On Mon, 04 Feb 2008 10:18:39 -0800, rdahlstrom wrote: > On Feb 4, 1:12 pm, Carl Banks <[EMAIL PROTECTED]> wrote: >> On Feb 4, 12:53 pm, rdahlstrom <[EMAIL PROTECTED]> wrote: >> > You have 500,000 people to fit through a door. Here are your options: >> >> > 1. For each person, open the door, walk

Re: Unexpected timing results with file I/O

2008-02-04 Thread rdahlstrom
On Feb 4, 1:12 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > On Feb 4, 12:53 pm, rdahlstrom <[EMAIL PROTECTED]> wrote: > > > > > On Feb 4, 10:17 am, Steven D'Aprano <[EMAIL PROTECTED] > > > cybersource.com.au> wrote: > > > After reading an earlier thread about opening and closing lots of files, > > >

Re: Unexpected timing results with file I/O

2008-02-04 Thread Carl Banks
On Feb 4, 12:53 pm, rdahlstrom <[EMAIL PROTECTED]> wrote: > On Feb 4, 10:17 am, Steven D'Aprano <[EMAIL PROTECTED] > > > > cybersource.com.au> wrote: > > After reading an earlier thread about opening and closing lots of files, > > I thought I'd do a little experiment. > > > Suppose you have a whole

Re: Unexpected timing results with file I/O

2008-02-04 Thread Gabriel Genellina
En Mon, 04 Feb 2008 15:53:11 -0200, rdahlstrom <[EMAIL PROTECTED]> escribi�: > On Feb 4, 10:17 am, Steven D'Aprano <[EMAIL PROTECTED] > cybersource.com.au> wrote: >> >> Suppose you have a whole lot of files, and you need to open each one, >> append a string, then close them. There's two obvious

Re: Unexpected timing results with file I/O

2008-02-04 Thread rdahlstrom
On Feb 4, 10:17 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > After reading an earlier thread about opening and closing lots of files, > I thought I'd do a little experiment. > > Suppose you have a whole lot of files, and you need to open each one, > append a string, then clos

Re: Unexpected timing results with file I/O

2008-02-04 Thread Marc 'BlackJack' Rintsch
On Mon, 04 Feb 2008 15:17:18 +, Steven D'Aprano wrote: > # Method one: grouped by file. > for each file: > open the file, append the string, then close it > > > # Method two: grouped by procedure. > for each file: > open the file > for each open file: > append the string > for ea

Re: Unexpected timing results with file I/O

2008-02-04 Thread Christian Heimes
Steven D'Aprano wrote: > So, what's going on? Can anyone explain why the code which does more work > takes less time? Short answer: CPU and RAM are much faster than hard disks. The three loops and the creation of a list costs only a few CPU cycles compared to flushing the new data to disk. Chri

Unexpected timing results with file I/O

2008-02-04 Thread Steven D'Aprano
After reading an earlier thread about opening and closing lots of files, I thought I'd do a little experiment. Suppose you have a whole lot of files, and you need to open each one, append a string, then close them. There's two obvious ways to do it: group your code by file, or group your code b

Re: timing puzzle

2007-11-16 Thread Neil Cerutti
On 2007-11-16, Robin Becker <[EMAIL PROTECTED]> wrote: > Neil Cerutti wrote: > ... > > > see why. >> >> You are no longer making m copies of active_nodes. > > my profiling indicated that the main problem was the removes. Yeah, I should've added, "for one thing." I'm glad Chris correctly poi

Re: timing puzzle

2007-11-16 Thread Robin Becker
Neil Cerutti wrote: ... see why. > > You are no longer making m copies of active_nodes. my profiling indicated that the main problem was the removes. > > > When you have to make many deletions from the middle of a > sequence, you would normally choose a linked list. Python doe

Re: timing puzzle

2007-11-16 Thread Robin Becker
Chris Mellon wrote: > > remove() does a linear search to find the item to remove, so it's O(n) > + the actual deletion. Append() is amortized O(1) (overcommit). If you > delete by index instead: > for idx, node in active_nodes: > if cond: > del active_nodes[idx] > > that's what I

Re: timing puzzle

2007-11-16 Thread Neil Cerutti
On 2007-11-16, Neil Cerutti <[EMAIL PROTECTED]> wrote: > Instead, filter your list. It looks like you can't use filter > directly, so just do it manually. > >for i in xrange(m): >... >saved_nodes = [] >for A in active_nodes[:]: I meant to remove the slice. That line

Re: timing puzzle

2007-11-16 Thread Neil Cerutti
On 2007-11-16, Robin Becker <[EMAIL PROTECTED]> wrote: > I'm trying to get my head round a timing puzzle I find whilst > optimizing A Kuchling's version of the Knuth line splitting > algorithm from the oedipus project. The puzzle is as follows in > highly abstract form

Re: timing puzzle

2007-11-16 Thread Chris Mellon
On Nov 16, 2007 12:42 PM, Robin Becker <[EMAIL PROTECTED]> wrote: > I'm trying to get my head round a timing puzzle I find whilst optimizing A > Kuchling's version of the Knuth line splitting algorithm from the oedipus > project. The puzzle is as follows in h

timing puzzle

2007-11-16 Thread Robin Becker
I'm trying to get my head round a timing puzzle I find whilst optimizing A Kuchling's version of the Knuth line splitting algorithm from the oedipus project. The puzzle is as follows in highly abstract form (here active_nodes is a list of objects kept in a sorted order, but th

Re: (sort of) deterministic timing in Python

2007-08-17 Thread Chris Mellon
On 8/17/07, Hendrik van Rooyen <[EMAIL PROTECTED]> wrote: > > "Paul Rubin" wrote: > > > >[EMAIL PROTECTED] (John Fisher) writes: > >> mark start time > >> start event > >> event finishes > >> count time until next interval > >> start second event… > >> > >> rather than this:

Re: (sort of) deterministic timing in Python

2007-08-17 Thread Hendrik van Rooyen
"Paul Rubin" wrote: >[EMAIL PROTECTED] (John Fisher) writes: >> mark start time >> start event >> event finishes >> count time until next interval >> start second event… >> >> rather than this: >> >> start event >> event finishes >> sleep for interval >> start s

Re: (sort of) deterministic timing in Python

2007-08-16 Thread Paul Rubin
[EMAIL PROTECTED] (John Fisher) writes: > mark start time > start event > event finishes > count time until next interval > start second event… > > rather than this: > > start event > event finishes > sleep for interval > start second event > ... > So how do I accomplish this in

Re: (sort of) deterministic timing in Python

2007-08-14 Thread Hendrik van Rooyen
"John Fisher" wrote: import time period_time = TIME_CONSTANT # The time of a period in seconds - 0.001 is a millisec >mark start time start_time = time.time() >start event >event finishes event_time = time.time() - start_time wait_time = period_time-event_time >count time until next

Re: (sort of) deterministic timing in Python

2007-08-13 Thread [EMAIL PROTECTED]
ase, > the sleep just gets tacked on at the end of the events, not very > deterministic (timing-wise). > > So how do I accomplish this in Python with a minimum of labour? > > Thanks for any light you can shed on my darkness... > > wave_man In the first example, you know when

Re: (sort of) deterministic timing in Python

2007-08-13 Thread Matimus
> Do you see the difference? I get a true fixed interval from the first, > including the time to accomplish the event task(s). In the second case, > the sleep just gets tacked on at the end of the events, not very > deterministic (timing-wise). Check out the sched (scheduler)

(sort of) deterministic timing in Python

2007-08-13 Thread John Fisher
second event Do you see the difference? I get a true fixed interval from the first, including the time to accomplish the event task(s). In the second case, the sleep just gets tacked on at the end of the events, not very deterministic (timing-wise). So how do I accomplish this in Python with a

Re: Timing a python program run

2007-07-08 Thread i3dmaster
simplest way is just put a timer on start and another on the end, then calc the elapse. You can also take a look timeit module too which provides similar but more powerful functions... -Jim On Jul 7, 2007, at 12:21 PM, David wrote: > Hi, > > In matlab, I'd calculate the time for a script nam

Re: Timing a python program run

2007-07-07 Thread Jyotirmoy Bhattacharya
On Jul 8, 12:21 am, David <[EMAIL PROTECTED]> wrote: > Hi, > > In matlab, I'd calculate the time for a script named test.m to run > with: > > >> tic, run, toc > > Is there some way to do this in python on a mac os x from the terminal > window? Or whatever? The timeit module may be of use: http://d

Re: Timing a python program run

2007-07-07 Thread Lawrence Oluyede
David <[EMAIL PROTECTED]> wrote: > Is there some way to do this in python on a mac os x from the terminal > window? Or whatever? You can use: % time script.py from the command line of the terminal -- Lawrence, oluyede.org - neropercaso.it "It is difficult to get a man to understand something

Timing a python program run

2007-07-07 Thread David
Hi, In matlab, I'd calculate the time for a script named test.m to run with: >> tic, run, toc Is there some way to do this in python on a mac os x from the terminal window? Or whatever? -- http://mail.python.org/mailman/listinfo/python-list

Re: Using Timing function problem.....

2007-01-25 Thread Jona
Thanks so much! that did it! you can tell I'm new with python.. lol... thanks again.. Jonathan -- http://mail.python.org/mailman/listinfo/python-list

Re: Using Timing function problem.....

2007-01-24 Thread Gabriel Genellina
At Thursday 25/1/2007 01:26, kevin wrote: Hi... I'm having a few problems here... I want to input in my function different values and then time each one to see how long it took to run the function... so right now it doesn't like the "i" inside my function fibonacci(i) but if I put a constant it

Using Timing function problem.....

2007-01-24 Thread kevin
3, in ? fib1 = mytime1.timeit(1) File "/usr/lib64/python2.4/timeit.py", line 161, in timeit timing = self.inner(it, self.timer) File "", line 6, in inner NameError: global name 'i' is not defined === -- http://mail.python.org/mailman/listinfo/python-list

Re: Timing a function object versus timeit

2006-11-03 Thread Steven D'Aprano
On Fri, 03 Nov 2006 18:02:37 -0800, Carl Banks wrote: import timeit timeit.Timer("foo(1)","from __main__ import foo") > 1.1497418880462646 Well, that was scarily simple. Thank you. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: Timing a function object versus timeit

2006-11-03 Thread Carl Banks
Steven D'Aprano wrote: > The timeit module is ideal for measuring small code snippets; I want to > measure large function objects. > > Because the timeit module takes the code snippet argument as a string, it > is quite handy to use from the command line, but it is less con

Timing a function object versus timeit

2006-11-03 Thread Steven D'Aprano
The timeit module is ideal for measuring small code snippets; I want to measure large function objects. Because the timeit module takes the code snippet argument as a string, it is quite handy to use from the command line, but it is less convenient for timing large pieces of code or when working

Re: python threading and timing

2006-10-03 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Laurent Pointal <[EMAIL PROTECTED]> wrote: . . . >May use Python for some -non realtime- parts, but I would not use any >scripting language (not specific to Python) for real-time work (prefer >C

Re: python threading and timing

2006-10-02 Thread Laurent Pointal
Dennis Lee Bieber a écrit : > On Sun, 1 Oct 2006 22:28:10 +0200, "Oeyvind Brandtsegg" > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > >> Also, I wonder what method I should be using to get a precise timing >> in my automation thread (act

python threading and timing

2006-10-01 Thread Oeyvind Brandtsegg
a precise timing in my automation thread (acting as a sequencer). I've attached two simple examples of different ways I could implement threads. The only task in these examples is to generate timed counters, but the general procedure would be the same for more complex timed tasks. One example

  1   2   >