Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #198037
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | ram@zedat.fu-berlin.de (Stefan Ram) |
| Newsgroups | comp.lang.python, comp.lang.c |
| Subject | Re: myrkraverk.c |
| Date | 20 Sep 2026 13:48:21 GMT |
| Organization | Stefan Ram |
| Lines | 28 |
| Expires | 1 Sep 2027 11:59:58 GMT |
| Message-ID | <time-20260920143911@ram.dialup.fu-berlin.de> (permalink) |
| References | <X0ArS.155893$NMu2.109571@fx15.ams4> <bits-20260919192308@ram.dialup.fu-berlin.de> <JbBrS.493032$a02.417651@fx11.ams4> <118mo9b$2i0j0$1@dont-email.me> <WjCrS.369387$G71.22768@fx17.ams4> <extension-20260919213739@ram.dialup.fu-berlin.de> <w9OrS.493051$a02.195416@fx11.ams4> <bits-20260920132258@ram.dialup.fu-berlin.de> <BgRrS.204631$Nn1.110223@fx18.ams4> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| X-Trace | news.uni-berlin.de y2EZZhrAXTdZT61J3n1s+AAb2oQfleRjYW/nt2DVBMif1K |
| Cancel-Lock | sha1:8sc59gI0r4PJfsw6lC5M9R2Ezqk= sha256:yKXkjhQ5c1o4C7ZSDIHY9WfMiDKJm8Ayhia1VwsY4N0= |
| X-Copyright | (C) Copyright 2026 Stefan Ram. All rights reserved. Distribution through any means other than regular usenet channels is forbidden. It is forbidden to publish this article in the Web, to change URIs of this article into links, and to transfer the body without this notice, but quotations of parts in other Usenet posts are allowed. |
| X-No-Archive | Yes |
| Archive | no |
| X-No-Archive-Readme | "X-No-Archive" is set, because this prevents some services to mirror the article in the web. But the article may be kept on a Usenet archive server with only NNTP access. |
| X-No-Html | yes |
| Content-Language | en |
| Xref | csiph.com comp.lang.python:198037 comp.lang.c:402301 |
Cross-posted to 2 groups.
Show key headers only | View raw
"Johann \"Myrkraverk\" Oskarsson" <johann@myrkraverk.invalid> wrote or quoted:
>Perhaps I should have made that clearer in the code comments?
No, I was too focused on just that one line,
not paying attention to the global context.
>A bit more worrying is that I do not off hand know how to time my cre-
>ation. This is because /timeit/ can't find it.
Maybe you can pass the globals which should contain the name
"count_lsb":
timeit.timeit("count_lsb(1 << 125)", globals=globals())
. The optional "globals" argument specifies a namespace in
which to execute the code.
You could also try the pattern,
start_time = timeit.default_timer()
count_lsb(1<<125)
dt = timeit.default_timer() - start_time
. However, when "count_lsb(1<<125)` is very fast, the results
might be less accurate. (You can ask your chatbot about
"pitfalls of microbenchmarks in Python".)
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
( n & -n ).bit_length() - 1 ## Really? "Johann \"Myrkraverk\" Oskarsson" <johann@myrkraverk.invalid> - 2026-09-20 01:56 +0800
Re: ( n & -n ).bit_length() - 1 ## Really? ram@zedat.fu-berlin.de (Stefan Ram) - 2026-09-19 18:23 +0000
Re: ( n & -n ).bit_length() - 1 ## Really? "Johann \"Myrkraverk\" Oskarsson" <johann@myrkraverk.invalid> - 2026-09-20 03:15 +0800
Re: ( n & -n ).bit_length() - 1 ## Really? Lane W <cactus_DAC@yahoo.com> - 2026-09-19 13:37 -0600
Re: ( n & -n ).bit_length() - 1 ## Really? "Johann \"Myrkraverk\" Oskarsson" <johann@myrkraverk.invalid> - 2026-09-20 04:32 +0800
Re: ( n & -n ).bit_length() - 1 ## Really? ram@zedat.fu-berlin.de (Stefan Ram) - 2026-09-19 20:39 +0000
Re: ( n & -n ).bit_length() - 1 ## Really? "Johann \"Myrkraverk\" Oskarsson" <johann@myrkraverk.invalid> - 2026-09-20 04:56 +0800
myrkraverk.c (was: Re: ( n & -n ).bit_length() - 1 ## Really?) "Johann \"Myrkraverk\" Oskarsson" <johann@myrkraverk.invalid> - 2026-09-20 18:00 +0800
Re: myrkraverk.c ram@zedat.fu-berlin.de (Stefan Ram) - 2026-09-20 12:25 +0000
Re: myrkraverk.c "Johann \"Myrkraverk\" Oskarsson" <johann@myrkraverk.invalid> - 2026-09-20 21:33 +0800
Re: myrkraverk.c ram@zedat.fu-berlin.de (Stefan Ram) - 2026-09-20 13:48 +0000
Re: myrkraverk.c "Johann \"Myrkraverk\" Oskarsson" <johann@myrkraverk.invalid> - 2026-09-20 22:09 +0800
jacobi_symbol.py (was: Re: myrkraverk.c) Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-09-21 20:34 +0800
Re: jacobi_symbol.py Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-09-22 15:20 +0800
Re: jacobi_symbol.py Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-09-25 23:32 +0800
Re: ( n & -n ).bit_length() - 1 ## Really? "Johann \"Myrkraverk\" Oskarsson" <johann@myrkraverk.invalid> - 2026-09-20 04:52 +0800
Re: ( n & -n ).bit_length() - 1 ## Really? Paul Rubin <no.email@nospam.invalid> - 2026-09-19 14:50 -0700
csiph-web