Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Episodes: Profiling Intro/Functions/Lines/Conclusion #5

Merged
merged 4 commits into from
Jan 29, 2024

Conversation

Robadob
Copy link
Member

@Robadob Robadob commented Dec 8, 2023

  • Probably should note somewhere that background processes and/or hardware features can make (non-deterministic) code have variable profiles. Shouldn't be an issue 99% of the time, as we're focusing on larger bottlenecks. But be aware, e.g. if program relies on network and something is downloading in the background!

Closes #2

@Robadob Robadob self-assigned this Dec 8, 2023
@Robadob Robadob changed the title Index draft. Introduction to Profiling Dec 8, 2023
@Robadob Robadob changed the title Introduction to Profiling Episode: Introduction to Profiling Dec 8, 2023
github-actions bot pushed a commit that referenced this pull request Dec 8, 2023
Copy link

github-actions bot commented Dec 8, 2023

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/RSE-Sheffield/pando-python/compare/md-outputs..md-outputs-PR-5

The following changes were observed in the rendered markdown documents:

 config.yaml                                        |   1 +
 fig/line_profiler-worked-example.png (new)         | Bin 0 -> 40125 bytes
 fig/snakeviz-home.png (new)                        | Bin 0 -> 94055 bytes
 fig/snakeviz-worked-example-icicle.png (new)       | Bin 0 -> 57626 bytes
 fig/snakeviz-worked-example-sunburst.png (new)     | Bin 0 -> 51469 bytes
 files/bubblesort/bubblesort.py (new)               |  28 ++
 .../line_profiler-worked-example/fizzbuzz.py (new) |  23 ++
 files/pred-prey/predprey.py (new)                  | 421 +++++++++++++++++++
 files/snakeviz-worked-example/example.py (new)     |  36 ++
 files/snakeviz-worked-example/out.prof (new)       | Bin 0 -> 1116 bytes
 files/travelling-sales/travellingsales.py (new)    |  48 +++
 md5sum.txt                                         |  13 +-
 profiling-conclusion.md (new)                      |  55 +++
 profiling-functions.md                             | 295 ++++++++++++-
 profiling-introduction.md                          | 213 +++++++++-
 profiling-lines.md                                 | 458 ++++++++++++++++++++-
 reference.md                                       |  33 +-
 setup.md                                           |   4 +-
 18 files changed, 1610 insertions(+), 18 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 2024-01-10 11:14:40 +0000

github-actions bot pushed a commit that referenced this pull request Dec 14, 2023
github-actions bot pushed a commit that referenced this pull request Dec 14, 2023
github-actions bot pushed a commit that referenced this pull request Dec 14, 2023
github-actions bot pushed a commit that referenced this pull request Jan 1, 2024
github-actions bot pushed a commit that referenced this pull request Jan 1, 2024
github-actions bot pushed a commit that referenced this pull request Jan 1, 2024
@Robadob Robadob marked this pull request as ready for review January 1, 2024 13:36
@Robadob Robadob requested a review from ptheywood January 1, 2024 13:36
github-actions bot pushed a commit that referenced this pull request Jan 1, 2024
@Robadob Robadob requested a review from gyengen January 3, 2024 16:50
<!-- It can be used for (where) -->
Profiling is useful when you have written any code that will be running for a substantial period of time.
As your code grows in complexity, it becomes increasingly difficult to estimate where time is being spent during execution.
Profiling allows you to narrow down where the time is being spent, to identify whether this is of concern or not.
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
Profiling allows you to narrow down where the time is being spent, to identify whether this is of concern or not.
Profiling allows you to narrow down where the time is being spent, to prioritise optimisation efforts.

## Selecting an Appropriate Test Case

<!-- Profiling runs slower -->
The act of profiling your code, collecting additional timing metrics during execution, will cause your program to execute slower. The slowdown is dependent on many variables, however the profiling covered by this course shouldn't more than double the runtime. <!-- Is this true? -->
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
The act of profiling your code, collecting additional timing metrics during execution, will cause your program to execute slower. The slowdown is dependent on many variables, however the profiling covered by this course shouldn't more than double the runtime. <!-- Is this true? -->
The act of profiling your code, collecting additional timing metrics during execution, will cause your program to execute slower. The slowdown is dependent on many variables, therefore it may be necessary to profile a reduced subset.

One of the examples within line-profiling is much slower, due to a method with alot of cheap statements and a loop being called 125,000 times.

Base automatically changed from wip to main January 10, 2024 09:29
@Robadob Robadob changed the title Episode: Introduction to Profiling Episodes: Profiling Intro/Functions/Lines/Conclusion Jan 10, 2024
github-actions bot pushed a commit that referenced this pull request Jan 10, 2024
@Robadob
Copy link
Member Author

Robadob commented Jan 10, 2024

This should now be ready for a high-level review of the full profiling training (4 episodes).

I will have a detailed low-level read through myself for other minor changes later this week.

@Robadob Robadob merged commit 6e976a3 into main Jan 29, 2024
3 checks passed
@Robadob Robadob deleted the profiling-introduction branch January 29, 2024 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Episode: Introduction to Profiling
1 participant