Skip to content

improve timeit examples#39

Merged
JostMigenda merged 1 commit intocarpentries-incubator:mainfrom
JostMigenda:timeit_examples
Feb 25, 2026
Merged

improve timeit examples#39
JostMigenda merged 1 commit intocarpentries-incubator:mainfrom
JostMigenda:timeit_examples

Conversation

@JostMigenda
Copy link
Copy Markdown
Collaborator

Closes #16.

  • vary number of repeats to ensure total runtime stays manageable
  • remove some ad hoc scaling factors
  • use total time instead of per-repeat time
  • format large numbers with _ for legibility
  • remove a few unnecessary int() calls

In particular, I’m curious what you think about the third point.

I was initially hesitant to change this. But since these are all toy examples (and e.g. use arbitrary list lengths), I don’t think the time per repeat is particularly meaningful? Switching to the total time (of all repeats) lets us vary the number of repeats without having to worry about scaling factors; and overall, I think this simplicity wins the argument for me.

* vary number of repeats to ensure total runtime stays manageable
* remove some ad hoc scaling factors
* use total time instead of per-run time
* format large numbers with _ for legibility
@JostMigenda JostMigenda requested a review from Robadob February 24, 2026 21:13
@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 24, 2026

Thank you!

Thank you for your pull request 😃

🤖 This automated message can help you check the rendered files in your submission for clarity. If you have any questions, please feel free to open an issue in {sandpaper}.

If you have files that automatically render output (e.g. R Markdown), then you should check for the following:

  • 🎯 correct output
  • 🖼️ correct figures
  • ❓ new warnings
  • ‼️ new errors

Rendered Changes

🔍 Inspect the changes: https://github.com/carpentries-incubator/pando-python/compare/md-outputs..md-outputs-PR-39

The following changes were observed in the rendered markdown documents:

 md5sum.txt                                 |   8 +--
 optimisation-data-structures-algorithms.md |  66 +++++++++----------
 optimisation-latency.md                    |  10 +--
 optimisation-numpy.md                      | 102 ++++++++++++++---------------
 optimisation-using-python.md               |  38 +++++------
 5 files changed, 111 insertions(+), 113 deletions(-)
What does this mean?

If you have source files that require output and figures to be generated (e.g. R Markdown), then it is important to make sure the generated figures and output are reproducible.

This output provides a way for you to inspect the output in a diff-friendly manner so that it's easy to see the changes that occur due to new software versions or randomisation.

⏱️ Updated at 2026-02-24 21:15:14 +0000

github-actions bot pushed a commit that referenced this pull request Feb 24, 2026
Copy link
Copy Markdown
Collaborator

@Robadob Robadob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems ok.

Per-time is mostly useful to make clear that most of these things are tiny, so fine if you're doing it once or twice. But terrible if they're central to your code or you're pushing them to huge scales.

@JostMigenda JostMigenda merged commit 22a853e into carpentries-incubator:main Feb 25, 2026
5 checks passed
github-actions bot pushed a commit that referenced this pull request Feb 25, 2026
Auto-generated via `{sandpaper}`
Source  : 22a853e
Branch  : main
Author  : Jost Migenda <jost.migenda@kcl.ac.uk>
Time    : 2026-02-25 00:07:48 +0000
Message : Merge pull request #39 from JostMigenda/timeit_examples
github-actions bot pushed a commit that referenced this pull request Feb 25, 2026
Auto-generated via `{sandpaper}`
Source  : 6228149
Branch  : md-outputs
Author  : GitHub Actions <actions@github.com>
Time    : 2026-02-25 00:09:37 +0000
Message : markdown source builds

Auto-generated via `{sandpaper}`
Source  : 22a853e
Branch  : main
Author  : Jost Migenda <jost.migenda@kcl.ac.uk>
Time    : 2026-02-25 00:07:48 +0000
Message : Merge pull request #39 from JostMigenda/timeit_examples
github-actions bot pushed a commit that referenced this pull request Mar 3, 2026
Auto-generated via `{sandpaper}`
Source  : 6228149
Branch  : md-outputs
Author  : GitHub Actions <actions@github.com>
Time    : 2026-02-25 00:09:37 +0000
Message : markdown source builds

Auto-generated via `{sandpaper}`
Source  : 22a853e
Branch  : main
Author  : Jost Migenda <jost.migenda@kcl.ac.uk>
Time    : 2026-02-25 00:07:48 +0000
Message : Merge pull request #39 from JostMigenda/timeit_examples
github-actions bot pushed a commit that referenced this pull request Mar 10, 2026
Auto-generated via `{sandpaper}`
Source  : 6228149
Branch  : md-outputs
Author  : GitHub Actions <actions@github.com>
Time    : 2026-02-25 00:09:37 +0000
Message : markdown source builds

Auto-generated via `{sandpaper}`
Source  : 22a853e
Branch  : main
Author  : Jost Migenda <jost.migenda@kcl.ac.uk>
Time    : 2026-02-25 00:07:48 +0000
Message : Merge pull request #39 from JostMigenda/timeit_examples
@JostMigenda JostMigenda deleted the timeit_examples branch March 16, 2026 13:49
github-actions bot pushed a commit that referenced this pull request Mar 17, 2026
Auto-generated via `{sandpaper}`
Source  : 6228149
Branch  : md-outputs
Author  : GitHub Actions <actions@github.com>
Time    : 2026-02-25 00:09:37 +0000
Message : markdown source builds

Auto-generated via `{sandpaper}`
Source  : 22a853e
Branch  : main
Author  : Jost Migenda <jost.migenda@kcl.ac.uk>
Time    : 2026-02-25 00:07:48 +0000
Message : Merge pull request #39 from JostMigenda/timeit_examples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check number of repeats for code examples

2 participants