t;
> Date: Friday, October 7, 2022 at 1:30 PM
> To: MRAB mailto:pyt...@mrabarnett.plus.com>>
> Cc: python-list@python.org <mailto:python-list@python.org>
> mailto:python-list@python.org>>
> Subject: Re: Ref-strings in logging messages (was: Performance issue with
hello"
logging.basicConfig()
logging.debug(Defer(some_expensive_function))
From: Python-list on
behalf of Barry
Date: Friday, October 7, 2022 at 1:30 PM
To: MRAB
Cc: python-list@python.org
Subject: Re: Ref-strings in logging messages (was: Performance issue with
CPython 3.10 + Cython)
*** Attentio
On Fri, 7 Oct 2022 18:28:06 +0100
Barry wrote:
> > On 7 Oct 2022, at 18:16, MRAB wrote:
> >
> > On 2022-10-07 16:45, Skip Montanaro wrote:
> >>> On Fri, Oct 7, 2022 at 9:42 AM Andreas Ames
> >>>
> >>> wrote:
> >>> 1. The culprit was me. As lazy as I am, I have used f-strings all over the
>
ebug = logger_from(DEBUG)
log_debug and log_debug(‘expensive %s’ % (complex(),))
Barry
>
> From: Python-list on
> behalf of Barry
> Date: Friday, October 7, 2022 at 1:30 PM
> To: MRAB
> Cc: python-list@python.org
> Subject: Re: Ref-strings in logging messages (was: Pe
To: MRAB
Cc: python-list@python.org
Subject: Re: Ref-strings in logging messages (was: Performance issue with
CPython 3.10 + Cython)
*** Attention: This is an external email. Use caution responding, opening
attachments or clicking on links. ***
> On 7 Oct 2022, at 18:16, MRAB wrote:
>
> On 7 Oct 2022, at 18:16, MRAB wrote:
>
> On 2022-10-07 16:45, Skip Montanaro wrote:
>>> On Fri, Oct 7, 2022 at 9:42 AM Andreas Ames
>>> wrote:
>>> 1. The culprit was me. As lazy as I am, I have used f-strings all over the
>>> place in calls to `logging.logger.debug()` and friends, evaluatin
On 2022-10-07 16:45, Skip Montanaro wrote:
On Fri, Oct 7, 2022 at 9:42 AM Andreas Ames
wrote:
1. The culprit was me. As lazy as I am, I have used f-strings all over the
place in calls to `logging.logger.debug()` and friends, evaluating all
arguments regardless of whether the logger was enabled
> On 7 Oct 2022, at 16:48, Skip Montanaro wrote:
>
> On Fri, Oct 7, 2022 at 9:42 AM Andreas Ames
> wrote:
>
>> 1. The culprit was me. As lazy as I am, I have used f-strings all over the
>> place in calls to `logging.logger.debug()` and friends, evaluating all
>> arguments regardless of wheth
Dang autocorrect. Subject first word was supposed to be "f-strings" not
"ref-strings." Sorry about that.
S
On Fri, Oct 7, 2022, 10:45 AM Skip Montanaro
wrote:
>
>
> On Fri, Oct 7, 2022 at 9:42 AM Andreas Ames
> wrote:
>
>> 1. The culprit was me. As lazy as I am, I have used f-strings all over
On Fri, Oct 7, 2022 at 9:42 AM Andreas Ames
wrote:
> 1. The culprit was me. As lazy as I am, I have used f-strings all over the
> place in calls to `logging.logger.debug()` and friends, evaluating all
> arguments regardless of whether the logger was enabled or not.
>
I thought there was some dis
Answering to myself, just for the records:
1. The culprit was me. As lazy as I am, I have used f-strings all over the
place in calls to `logging.logger.debug()` and friends, evaluating all
arguments regardless of whether the logger was enabled or not. Replacing
these f-strings by regular printf-l
Hi all,
I am wrapping an embedded application (, which does not use any dynamic
memory management,) using Cython to call it from CPython. The wrapped
application uses a cyclic executive, i.e. everything is done in the
input-logic-output design, typical for some real-time related domains.
Conseque
On Sun, 31 Jan 2010 20:58:50 -0800, keakon wrote:
> I've found strange performance issue when using default value, the test
> code is list below:
>
> from timeit import Timer
>
> def f(x):
> y = x
> y.append(1)
> return y
>
> def g(x=[]):
> y =
keakon wrote:
> The default value is mutable, and can be reused by all each call.
> So each call it will append 1 to the default value, that's very
> different than C++.
Being different from C++ is one of the many reasons some of us choose
Python ;)
This tends to bite most newcomers, so it's men
On 2月1日, 下午1时20分, alex23 wrote:
> alex23 wrote:
> > keakon wrote:
> > > def h2(x=[]):
> > > y = x
> > > y.append(1)
> > > return y + []
>
> > Are you aware that 'y = x' _doesn't_ make a copy of [], that it
> > actually points to the same list as x?
>
> Sorry, I meant to suggest trying the
alex23 wrote:
> keakon wrote:
> > def h2(x=[]):
> > y = x
> > y.append(1)
> > return y + []
>
> Are you aware that 'y = x' _doesn't_ make a copy of [], that it
> actually points to the same list as x?
Sorry, I meant to suggest trying the following instead:
def h2(x=None):
if x is None:
On Sun, Jan 31, 2010 at 8:58 PM, keakon wrote:
> I've found strange performance issue when using default value, the
> test code is list below:
>
> from timeit import Timer
>
> def f(x):
> y = x
> y.append(1)
> return y
>
> def g(x=[]):
> y = []
> y
keakon wrote:
> def h2(x=[]):
> y = x
> y.append(1)
> return y + []
> h2() is about 42 times slower than h2([]), but h() is a litter faster
> than h([]).
Are you aware that 'y = x' _doesn't_ make a copy of [], that it
actually points to the same list as x?
My guess is that the slowdown yo
I've found strange performance issue when using default value, the
test code is list below:
from timeit import Timer
def f(x):
y = x
y.append(1)
return y
def g(x=[]):
y = []
y.append(1)
return y
def h(x=[]):
y = x
y.append(1)
return y
def f2(x):
y = x
y.app
Ulrich Eckhardt wrote:
Dan Stromberg wrote:
My new version formats an SD card and preallocates some file space in
about 3 minutes with "Optimize Performance" selected, and in about 30
minutes with "Optimize for Quick Removal" selected. Needless to say, I
don't like the 27 minute penalty much
Steven D'Aprano wrote:
On Mon, 05 Oct 2009 22:31:05 -0700, Dan Stromberg wrote:
I'm rewriting 3 programs as one program - from Python with Tkinter to
Python with pygtk, both on Windows XP.
My new version formats an SD card and preallocates some file space in
about 3 minutes with "Optimize P
Dan Stromberg wrote:
> My new version formats an SD card and preallocates some file space in
> about 3 minutes with "Optimize Performance" selected, and in about 30
> minutes with "Optimize for Quick Removal" selected. Needless to say, I
> don't like the 27 minute penalty much.
For performance, t
On Mon, 05 Oct 2009 22:31:05 -0700, Dan Stromberg wrote:
> I'm rewriting 3 programs as one program - from Python with Tkinter to
> Python with pygtk, both on Windows XP.
>
> My new version formats an SD card and preallocates some file space in
> about 3 minutes with "Optimize Performance" selecte
I'm rewriting 3 programs as one program - from Python with Tkinter to
Python with pygtk, both on Windows XP.
My new version formats an SD card and preallocates some file space in
about 3 minutes with "Optimize Performance" selected, and in about 30
minutes with "Optimize for Quick Removal" s
On Sat, Feb 14, 2009 at 3:01 PM, Peter Otten <__pete...@web.de> wrote:
> Gabriel Genellina wrote:
>
> > En Fri, 13 Feb 2009 08:16:00 -0200, S.Selvam Siva <
> s.selvams...@gmail.com>
> > escribió:
> >
> >> I need some help.
> >> I tried to find top n(eg. 5) similar words for a given word, from a
>
Gabriel Genellina wrote:
> En Fri, 13 Feb 2009 08:16:00 -0200, S.Selvam Siva
> escribió:
>
>> I need some help.
>> I tried to find top n(eg. 5) similar words for a given word, from a
>> dictionary of 50,000 words.
>> I used python-levenshtein module,and sample code is as follow.
>>
>> def foo(se
On Feb 13, 5:42 am, "Gabriel Genellina"
wrote:
> You may replace the last steps (sort + slice top 5) by heapq.nlargest - at
> least you won't waste time sorting 49995 irrelevant words...
> Anyway you should measure the time taken by the first part (Levenshtein),
> it may be the most demanding.
Gabriel Genellina wrote:
En Fri, 13 Feb 2009 08:16:00 -0200, S.Selvam Siva
escribió:
I need some help.
I tried to find top n(eg. 5) similar words for a given word, from a
dictionary of 50,000 words.
I used python-levenshtein module,and sample code is as follow.
def foo(searchword):
disdi
En Fri, 13 Feb 2009 08:16:00 -0200, S.Selvam Siva
escribió:
I need some help.
I tried to find top n(eg. 5) similar words for a given word, from a
dictionary of 50,000 words.
I used python-levenshtein module,and sample code is as follow.
def foo(searchword):
disdict={}
for word in sel
Hi all,
I need some help.
I tried to find top n(eg. 5) similar words for a given word, from a
dictionary of 50,000 words.
I used python-levenshtein module,and sample code is as follow.
def foo(searchword):
disdict={}
for word in self.dictionary-words:
distance=Levenshte
Gabriel Genellina wrote:
En Wed, 14 May 2008 13:51:40 -0300, Ethan Furman
<[EMAIL PROTECTED]> escribió:
Gabriel Genellina wrote:
En Mon, 05 May 2008 15:56:26 -0300, Ethan Furman
<[EMAIL PROTECTED]> escribió:
I tried adding a form to our website for uploading large files.
Personally, I
En Wed, 14 May 2008 13:51:40 -0300, Ethan Furman <[EMAIL PROTECTED]>
escribió:
Gabriel Genellina wrote:
En Mon, 05 May 2008 15:56:26 -0300, Ethan Furman
<[EMAIL PROTECTED]> escribió:
I tried adding a form to our website for uploading large files.
Personally, I dislike the forms that tell yo
Gabriel Genellina wrote:
En Mon, 05 May 2008 15:56:26 -0300, Ethan Furman <[EMAIL PROTECTED]> escribió:
I tried adding a form to our website for uploading large files.
Personally, I dislike the forms that tell you you did something wrong
and make you re-enter *all* your data again, so this
En Mon, 05 May 2008 15:56:26 -0300, Ethan Furman <[EMAIL PROTECTED]> escribió:
> I tried adding a form to our website for uploading large files.
> Personally, I dislike the forms that tell you you did something wrong
> and make you re-enter *all* your data again, so this one cycles and
> remembers
Greetings!
I tried adding a form to our website for uploading large files.
Personally, I dislike the forms that tell you you did something wrong
and make you re-enter *all* your data again, so this one cycles and
remembers your answers, and only prompts for the file once the rest of
the ente
David J. Braden wrote:
> Travis E. Oliphant wrote:
>> Brendon Towle wrote:
>>> I need to simulate scenarios like the following: "You have a deck of
>>> 3 orange cards, 5 yellow cards, and 2 blue cards. You draw a card,
>>> replace it, and repeat N times."
>>>
>>
>> Thinking about the problem as
Travis E. Oliphant wrote:
> Brendon Towle wrote:
>> I need to simulate scenarios like the following: "You have a deck of
>> 3 orange cards, 5 yellow cards, and 2 blue cards. You draw a card,
>> replace it, and repeat N times."
>>
>
> Thinking about the problem as drawing sample froms a discret
On 13 Sep 2006, at 1:01 AM, [EMAIL PROTECTED] wrote:
> Date: 12 Sep 2006 20:17:47 -0700
> From: Paul Rubin <http://[EMAIL PROTECTED]>
> Subject: Re: Random Drawing Simulation -- performance issue
> To: python-list@python.org
>
> "Travis E. Oliphant" <[EM
On 12 Sep 2006, at 6:33 PM, [EMAIL PROTECTED] wrote:
> Date: 12 Sep 2006 15:23:51 -0700
> From: "Simon Forman" <[EMAIL PROTECTED]>
> Subject: Re: Random Drawing Simulation -- performance issue
>
> Brendon Towle wrote:
>> I need to simulate scenarios like th
Paul Rubin wrote:
> "Travis E. Oliphant" <[EMAIL PROTECTED]> writes:
>>> I need to simulate scenarios like the following: "You have a deck of
>>> 3 orange cards, 5 yellow cards, and 2 blue cards. You draw a card,
>>> replace it, and repeat N times."
>>>
>> Thinking about the problem as drawing samp
"Travis E. Oliphant" <[EMAIL PROTECTED]> writes:
> > I need to simulate scenarios like the following: "You have a deck of
> > 3 orange cards, 5 yellow cards, and 2 blue cards. You draw a card,
> > replace it, and repeat N times."
> >
> Thinking about the problem as drawing sample froms a discrete
>
Brendon Towle wrote:
> I need to simulate scenarios like the following: "You have a deck of
> 3 orange cards, 5 yellow cards, and 2 blue cards. You draw a card,
> replace it, and repeat N times."
>
Thinking about the problem as drawing sample froms a discrete
distribution defined by the popu
Brendon Towle wrote:
> I need to simulate scenarios like the following: "You have a deck of
> 3 orange cards, 5 yellow cards, and 2 blue cards. You draw a card,
> replace it, and repeat N times."
>
> So, I wrote the following code, which works, but it seems quite slow
> to me. Can anyone point out
Brendon Towle wrote:
> I need to simulate scenarios like the following: "You have a deck of 3
> orange cards, 5 yellow cards, and 2 blue cards. You draw a card, replace
> it, and repeat N times."
>
> So, I wrote the following code, which works, but it seems quite slow to
> me. Can anyone point
I need to simulate scenarios like the following: "You have a deck of
3 orange cards, 5 yellow cards, and 2 blue cards. You draw a card,
replace it, and repeat N times."
So, I wrote the following code, which works, but it seems quite slow
to me. Can anyone point out some obvious thing that I'
Marc 'BlackJack' Rintsch wrote:
def make_anagram_map(words):
anagram_map = dict()
for word in imap(lambda w: w.strip().lower(), words):
sorted_word = ''.join(sorted(list(word)))
anagram_map.setdefault(sorted_word, list()).append(word)
return dict(ifilter(lambda x: l
On Sat, 02 Apr 2005 10:29:19 -0800, Shalabh Chaturvedi <[EMAIL PROTECTED]>
wrote:
>Tom Carrick wrote:
>> Hi,
>>
>> In my attempted learning of python, I've decided to recode an old
>> anagram solving program I made in C++. The C++ version runs in less
>> than a second, while the python takes 30
In <[EMAIL PROTECTED]>, Tom Carrick
wrote:
> In my attempted learning of python, I've decided to recode an old
> anagram solving program I made in C++. The C++ version runs in less
> than a second, while the python takes 30 seconds. I'm not willing to
> think it's just python being slow, so I was
Tom Carrick wrote:
Hi,
In my attempted learning of python, I've decided to recode an old
anagram solving program I made in C++. The C++ version runs in less
than a second, while the python takes 30 seconds. I'm not willing to
think it's just python being slow, so I was hoping someone could find
a f
Tom Carrick wrote:
Hi,
In my attempted learning of python, I've decided to recode an old
anagram solving program I made in C++. The C++ version runs in less
than a second, while the python takes 30 seconds. I'm not willing to
think it's just python being slow, so I was hoping someone could find
a f
Tom Carrick <[EMAIL PROTECTED]> writes:
> In my attempted learning of python, I've decided to recode an old
> anagram solving program I made in C++. The C++ version runs in less
> than a second, while the python takes 30 seconds.
Indeed, your program can be improved to run about ten times as fast
"Tom Carrick" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
| Hi,
|
| In my attempted learning of python, I've decided to recode an old
| anagram solving program I made in C++. The C++ version runs in less
| than a second, while the python takes 30 seconds. I'm not willing to
|
In <[EMAIL PROTECTED]>, Irmen de Jong wrote:
>> words = file.splitlines()
>
> You can obtain this list without reading the file in its entirety,
> by using the readlines method of file objects:
>
> words=open("words.txt").readlines()
This leaves the newline characters at the end of each line wh
rdlist = string2list(words[0])
> wordlist.sort(lambda x, y: cmp(x, y))
> sorted_wordlist = wordlist
> if sorted_anagram == sorted_wordlist:
> found.append(words[0])
> del words[0]
And here's the performance issue. Deleting the first element of a lis
Tom Carrick wrote:
> Hi,
>
> In my attempted learning of python, I've decided to recode an old
> anagram solving program I made in C++. The C++ version runs in less
> than a second, while the python takes 30 seconds. I'm not willing to
> think it's just python being slow, so I was hoping someone c
Hi,
In my attempted learning of python, I've decided to recode an old
anagram solving program I made in C++. The C++ version runs in less
than a second, while the python takes 30 seconds. I'm not willing to
think it's just python being slow, so I was hoping someone could find
a faster way of doing
56 matches
Mail list logo