Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

The church saves sinners, but science seeks to stop their manufacture. -- Elbert Hubbard


devel / comp.lang.python / Re: Does loading PDB slow down execution?

SubjectAuthor
* Does loading PDB slow down execution?Unixnut
`* Re: Does loading PDB slow down execution?Dieter Maurer
 `* Re: Does loading PDB slow down execution?Unixnut
  +- Re: Does loading PDB slow down execution?Benjamin Schollnick
  `- Re: Does loading PDB slow down execution?Peter J. Holzer

1
Does loading PDB slow down execution?

<ndip2i-rb03.ln1@news.witheredfire.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15546&group=comp.lang.python#15546

  copy link   Newsgroups: comp.lang.python
Path: rocksolid2!news.neodome.net!news.mixmin.net!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: unix...@witheredfire.com (Unixnut)
Newsgroups: comp.lang.python
Subject: Does loading PDB slow down execution?
Date: Sun, 3 Oct 2021 22:03:19 +0100
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <ndip2i-rb03.ln1@news.witheredfire.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="0a1111fffb64895e94f4672e4470674f";
logging-data="955"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18iynIXA3kf3LR1F8nHOduZ"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.14.0
Cancel-Lock: sha1:rnsHBDBXRRpqL2wl6toKRtdBOCA=
Content-Language: en-US
X-Mozilla-News-Host: news://news.cosmos.lnet:119
 by: Unixnut - Sun, 3 Oct 2021 21:03 UTC

Hi all,

If I run a python3 program with "import pdb" in the code, would it
execute slower than without loading the debugger?

The program I am running is computationally expensive and mathematically
orientated. It is expected to run for a few months (I am a few days in).
I found out today that I forgot to comment out the "import pdb" while
debugging, and now I am wondering if there would be a performance
benefit worth restarting the execution with pdb unloaded.

I have tried testing this with a simple sum executable, but I don't see
a clear difference with short execution times (<5 mins). Before I
investigate further, I thought I would ask and see if anyone knows the
answer already.

Many thanks!

Re: Does loading PDB slow down execution?

<mailman.936.1633542594.4164.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15574&group=comp.lang.python#15574

  copy link   Newsgroups: comp.lang.python
Path: rocksolid2!news.neodome.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: die...@handshake.de (Dieter Maurer)
Newsgroups: comp.lang.python
Subject: Re: Does loading PDB slow down execution?
Date: Wed, 6 Oct 2021 19:30:33 +0200
Lines: 13
Message-ID: <mailman.936.1633542594.4164.python-list@python.org>
References: <ndip2i-rb03.ln1@news.witheredfire.com>
<24925.56633.615436.668290@ixdm.fritz.box>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de EYLA79hRC+Hdcz+FOIOGnQaaZbp1vKIXSp/3vxvT2MBw==
Return-Path: <dieter@handshake.de>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.070
X-Spam-Evidence: '*H*': 0.87; '*S*': 0.01; 'cc:addr:python-list':
0.09; 'cc:no real name:2**0': 0.14; 'import': 0.15; '"import':
0.16; '(because': 0.16; '(it': 0.16; 'call,': 0.16; 'debugger':
0.16; 'importing': 0.16; 'python3': 0.16; 'slow': 0.16;
'subject:loading': 0.16; 'cc:addr:python.org': 0.20; 'code': 0.23;
'run': 0.23; 'received:de': 0.23; 'cc:2**0': 0.25; 'function':
0.27; 'code,': 0.31; 'program': 0.31; 'execution': 0.32; 'but':
0.32; 'header:In-Reply-To:1': 0.34; 'otherwise': 0.39; 'wrote':
0.39; 'down': 0.64; 'header:Received:6': 0.67; 'during': 0.69;
'adds': 0.69; 'control,': 0.69; 'received:88': 0.84;
'subject:Does': 0.84; 'affect': 0.91; 'return,': 0.91; 'line,':
0.93
In-Reply-To: <ndip2i-rb03.ln1@news.witheredfire.com>
X-Mailer: VM 8.0.12-devo-585 under 21.4 (patch 24) "Standard C" XEmacs Lucid
(x86_64-linux-gnu)
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <24925.56633.615436.668290@ixdm.fritz.box>
X-Mailman-Original-References: <ndip2i-rb03.ln1@news.witheredfire.com>
 by: Dieter Maurer - Wed, 6 Oct 2021 17:30 UTC

Unixnut wrote at 2021-10-3 22:03 +0100:
>If I run a python3 program with "import pdb" in the code, would it
>execute slower than without loading the debugger?

Importing `pdb` does not slow down the application significantly
(it just adds the import time but does not otherwise affect the
application).

Only when you execute code under debugger control, the
execution is significantly slowed down (because the debugger
gets informed (via callbacks) about important "event"s (entering
a line, function call, function return, exception) during
the execution).

Re: Does loading PDB slow down execution?

<20ef8bcc-9fdb-7894-2c7f-9fab3c0532c0@witheredfire.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15783&group=comp.lang.python#15783

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: unix...@witheredfire.com (Unixnut)
Newsgroups: comp.lang.python
Subject: Re: Does loading PDB slow down execution?
Date: Wed, 27 Oct 2021 18:01:42 +0100
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <20ef8bcc-9fdb-7894-2c7f-9fab3c0532c0@witheredfire.com>
References: <ndip2i-rb03.ln1@news.witheredfire.com>
<24925.56633.615436.668290@ixdm.fritz.box>
<mailman.936.1633542594.4164.python-list@python.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="a41e185b14c30138d8981f2b208a2d45";
logging-data="15210"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19TjCKZ+QDO024MDhL8lufn"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.14.0
Cancel-Lock: sha1:oNwd9CbRs775um179OTy8ldrfVQ=
In-Reply-To: <mailman.936.1633542594.4164.python-list@python.org>
Content-Language: en-US
Disposition-Notification-To: Unixnut <unixnut@witheredfire.com>
 by: Unixnut - Wed, 27 Oct 2021 17:01 UTC

On 06/10/2021 18:30, Dieter Maurer wrote:
> Unixnut wrote at 2021-10-3 22:03 +0100:
>> If I run a python3 program with "import pdb" in the code, would it
>> execute slower than without loading the debugger?
>
> Importing `pdb` does not slow down the application significantly
> (it just adds the import time but does not otherwise affect the
> application).
>
> Only when you execute code under debugger control, the
> execution is significantly slowed down (because the debugger
> gets informed (via callbacks) about important "event"s (entering
> a line, function call, function return, exception) during
> the execution).
>
Excellent, many thanks for confirming. I can leave the execution running
then.

Re: Does loading PDB slow down execution?

<mailman.89.1635364032.23718.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15789&group=comp.lang.python#15789

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: bscholln...@schollnick.net (Benjamin Schollnick)
Newsgroups: comp.lang.python
Subject: Re: Does loading PDB slow down execution?
Date: Wed, 27 Oct 2021 15:47:08 -0400
Lines: 27
Message-ID: <mailman.89.1635364032.23718.python-list@python.org>
References: <ndip2i-rb03.ln1@news.witheredfire.com>
<24925.56633.615436.668290@ixdm.fritz.box>
<mailman.936.1633542594.4164.python-list@python.org>
<20ef8bcc-9fdb-7894-2c7f-9fab3c0532c0@witheredfire.com>
<AC66C65F-6505-4159-A6AF-7105CCECCB71@schollnick.net>
Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.20.0.1.32\))
Content-Type: text/plain;
charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de 49bqX0Y6m4GE+FUeGEk4RQvmzuReaXrCrar1kQN6JFnQ==
Return-Path: <bschollnick@schollnick.net>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="1024-bit key; unprotected key"
header.d=schollnick.net header.i=@schollnick.net header.b=YRwVaEZz;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.005
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'debugging': 0.07;
'performing': 0.07; '27,': 0.09; 'cc:addr:python-list': 0.09;
'then.': 0.09; 'cc:no real name:2**0': 0.14; 'import': 0.15;
'"import': 0.16; '(because': 0.16; '(it': 0.16; '(so': 0.16;
'call,': 0.16; 'debugger': 0.16; 'dieter': 0.16; 'importing':
0.16; 'python3': 0.16; 'received:apple': 0.16;
'received:smtpclient.apple': 0.16; 'slow': 0.16;
'subject:loading': 0.16; 'wrote:': 0.16; 'pm,': 0.19;
'cc:addr:python.org': 0.20; 'maybe': 0.22; 'code': 0.23; 'run':
0.23; 'cc:2**0': 0.25; 'leave': 0.27; 'function': 0.27; '>>>':
0.28; 'suggest': 0.28; 'code,': 0.31; 'program': 0.31;
'execution': 0.32; 'but': 0.32; 'header:In-Reply-To:1': 0.34;
'received:google.com': 0.34; 'running': 0.34; 'received:209.85':
0.37; 'thanks': 0.38; 'received:209': 0.39; 'otherwise': 0.39;
'use': 0.39; 'received:209.85.222': 0.39; 'wrote': 0.39;
'received:98': 0.40; 'best': 0.61; 'down': 0.64; 'during': 0.69;
'adds': 0.69; 'control,': 0.69; '1:01': 0.84; 'subject:Does':
0.84; 'affect': 0.91; 'return,': 0.91; 'line,': 0.93
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=schollnick.net; s=schollnick;
h=mime-version:subject:from:in-reply-to:date:cc
:content-transfer-encoding:message-id:references:to;
bh=wye06KnHknUdEcDK0OR7ODkAj0t7K8LT6iTBYojmVXw=;
b=YRwVaEZzxrOVe/k1sZ+uaLkm7ec2KzqdMbjzxiQ/oHkjoDdJzw85L2tN8OQfvucxlD
+VvoCjtNv18ZmnyYymbwYLRUiRGxR2axGlNvMkt8gDvMj1u+dLeN2YdX85VoJlw0uxrV
K1+HeUozQVj2itSpDH0dChGwn5nXbW8ua+om8=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc
:content-transfer-encoding:message-id:references:to;
bh=wye06KnHknUdEcDK0OR7ODkAj0t7K8LT6iTBYojmVXw=;
b=RH83abQq9pFhVbXnyzNYTQTPSyQsHBbbT1KBYz0VZxfUuEjxi8szVUA992pU+BX0p/
aOGdLCEq0e2dWfolgFz8qJfV70BjWHrzPm2me1Fh7Dw6ZER1kBD0RsyUJHHqjyYFcBrw
xd+xI2ouug5sdkbHuShnef2LufnNT52QqWj2TLL654ITE2SWq32mOfIO0lixI4QZyQFG
Km5x1iJPszHA4LWCKyt0nbEWDocJIN2g/D6bn1gezrDtmcNQavWaIyO4+KbLx2jfIu+T
FmVJZyxonmTdvkqqXwQGVOTuQCW2ypaj9p+so+mcPA+eT/Z474bSUv7j1BoIVL/HjQUW
1VFw==
X-Gm-Message-State: AOAM530sJeYywJ65ejLNaeMIcjWC41/lxpSV5elMHgcbm5flXTniahps
C3PMV7wnhojcSPUbukbea1HTxD5eFUNkv/sX
X-Google-Smtp-Source: ABdhPJxGESMPVxsZesd5rrmyw4HR2cq6hPY0Y0H1ZN+w5uDDFnz9P8ubVhGG520xDGQNfMEfrJekLA==
X-Received: by 2002:a05:620a:190c:: with SMTP id
bj12mr26519822qkb.325.1635364029442;
Wed, 27 Oct 2021 12:47:09 -0700 (PDT)
In-Reply-To: <20ef8bcc-9fdb-7894-2c7f-9fab3c0532c0@witheredfire.com>
X-Mailer: Apple Mail (2.3693.20.0.1.32)
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.35
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <AC66C65F-6505-4159-A6AF-7105CCECCB71@schollnick.net>
X-Mailman-Original-References: <ndip2i-rb03.ln1@news.witheredfire.com>
<24925.56633.615436.668290@ixdm.fritz.box>
<mailman.936.1633542594.4164.python-list@python.org>
<20ef8bcc-9fdb-7894-2c7f-9fab3c0532c0@witheredfire.com>
 by: Benjamin Schollnick - Wed, 27 Oct 2021 19:47 UTC

> On Oct 27, 2021, at 1:01 PM, Unixnut <unixnut@witheredfire.com> wrote:
>
> On 06/10/2021 18:30, Dieter Maurer wrote:
>> Unixnut wrote at 2021-10-3 22:03 +0100:
>>> If I run a python3 program with "import pdb" in the code, would it
>>> execute slower than without loading the debugger?
>> Importing `pdb` does not slow down the application significantly
>> (it just adds the import time but does not otherwise affect the
>> application).
>> Only when you execute code under debugger control, the
>> execution is significantly slowed down (because the debugger
>> gets informed (via callbacks) about important "event"s (entering
>> a line, function call, function return, exception) during
>> the execution).
> Excellent, many thanks for confirming. I can leave the execution running then.

But it’s pointless to import pdb, if you aren’t going to use it.

I would suggest that a best practice would be to only import pdb, if and when you were going to be performing the debugging.
(So maybe set a boolean constant, that would cause the import, and debugging code to be executed.

Re: Does loading PDB slow down execution?

<mailman.91.1635364334.23718.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15791&group=comp.lang.python#15791

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: hjp-pyt...@hjp.at (Peter J. Holzer)
Newsgroups: comp.lang.python
Subject: Re: Does loading PDB slow down execution?
Date: Wed, 27 Oct 2021 21:52:10 +0200
Lines: 46
Message-ID: <mailman.91.1635364334.23718.python-list@python.org>
References: <ndip2i-rb03.ln1@news.witheredfire.com>
<24925.56633.615436.668290@ixdm.fritz.box>
<mailman.936.1633542594.4164.python-list@python.org>
<20ef8bcc-9fdb-7894-2c7f-9fab3c0532c0@witheredfire.com>
<AC66C65F-6505-4159-A6AF-7105CCECCB71@schollnick.net>
<YXmt6itqwypCZ76A@hjp.at>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
protocol="application/pgp-signature"; boundary="hu8zG7LmvhyetQhu"
X-Trace: news.uni-berlin.de WXj8+0iNVsLGzsmmIeWRwwZemYzyAfemxvLnBzqQp1wA==
Return-Path: <hjp-python@hjp.at>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'content-
type:multipart/signed': 0.05; '27,': 0.09; 'content-
type:application/pgp-signature': 0.09; 'filename:fname piece:asc':
0.09; 'filename:fname piece:signature': 0.09;
'filename:fname:signature.asc': 0.09; 'then.': 0.09; 'import':
0.15; '"creative': 0.16; '__/': 0.16; 'challenge!"': 0.16;
'from:addr:hjp-python': 0.16; 'from:addr:hjp.at': 0.16;
'from:name:peter j. holzer': 0.16; 'hjp@hjp.at': 0.16; 'holzer':
0.16; 'reality.': 0.16; 'stross,': 0.16; 'subject:loading': 0.16;
'thread.': 0.16; 'url-ip:212.17.106.137/32': 0.16; 'url-
ip:212.17.106/24': 0.16; 'url-ip:212.17/16': 0.16; 'url:hjp':
0.16; '|_|_)': 0.16; 'wrote:': 0.16; 'pm,': 0.19; 'to:addr:python-
list': 0.20; 'leave': 0.27; 'sense': 0.28; 'execution': 0.32;
'but': 0.32; 'header:In-Reply-To:1': 0.34; 'running': 0.34;
'read': 0.38; 'thanks': 0.38; 'use': 0.39; 'received:212': 0.62;
'received:userid': 0.66; 'url-ip:212/8': 0.69; '1:01': 0.84;
'received:at': 0.84; 'subject:Does': 0.84
Content-Disposition: inline
In-Reply-To: <AC66C65F-6505-4159-A6AF-7105CCECCB71@schollnick.net>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.35
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <YXmt6itqwypCZ76A@hjp.at>
X-Mailman-Original-References: <ndip2i-rb03.ln1@news.witheredfire.com>
<24925.56633.615436.668290@ixdm.fritz.box>
<mailman.936.1633542594.4164.python-list@python.org>
<20ef8bcc-9fdb-7894-2c7f-9fab3c0532c0@witheredfire.com>
<AC66C65F-6505-4159-A6AF-7105CCECCB71@schollnick.net>
 by: Peter J. Holzer - Wed, 27 Oct 2021 19:52 UTC
Attachments: signature.asc (application/pgp-signature)

On 2021-10-27 15:47:08 -0400, Benjamin Schollnick wrote:
> > On Oct 27, 2021, at 1:01 PM, Unixnut <unixnut@witheredfire.com> wrote:
[...]
> > Excellent, many thanks for confirming. I can leave the execution running then.
>
> But it’s pointless to import pdb, if you aren’t going to use it.

Please read the first mail in this thread.

hp

--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp@hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"

Attachments: signature.asc (application/pgp-signature)
1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor