Skip to content

Commit 45751ef

Browse files
author
Anastasiia Shcherbakova
committed
Fixed gammar issues
1 parent 5a31eff commit 45751ef

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

episodes/profiling-lines.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ exercises: 30
2727
Whilst profiling, you may find that function-level profiling highlights expensive methods where you can't easily determine the cause of the cost due to their complexity.
2828

2929
<!-- What -->
30-
Line level profiling allows you to target specific methods to collect more granular metrics, which can help narrow the source of expensive computation further. Typically line-level profiling will calculate the number of times each line is called and the total time spent executing each line. However, with the increased granularity come increased collection costs, which is why it's targeted to specific methods.
30+
Line level profiling allows you to target specific methods to collect more granular metrics, which can help narrow the source of expensive computation further. Typically, line-level profiling will calculate the number of times each line is called and the total time spent executing each line. However, with the increased granularity come increased collection costs, which is why it's targeted to specific methods.
3131

3232
<!-- Why -->
3333
This allows lines that occupy a disproportionate amount of the total runtime to be quickly identified and investigated.
@@ -263,7 +263,7 @@ The `-r` argument passed to `kernprof` (or `line_profiler`) enables rich output,
263263

264264
## line_profiler Inside Notebooks
265265

266-
If you're more familiar with writing Python inside Jupyter notebooks you can, as with `snakeviz`, use `line_profiler` directly from inside notebooks. However it is still necessary for the code you wish to profile to be placed within a function.
266+
If you're more familiar with writing Python inside Jupyter notebooks you can, as with `snakeviz`, use `line_profiler` directly from inside notebooks. However, it is still necessary for the code you wish to profile to be placed within a function.
267267

268268
First `line_profiler` must be installed and it's extension loaded.
269269

@@ -282,7 +282,7 @@ The functions to be line profiled are specified with `-f <function name>`, this
282282

283283
This is followed by calling the function which runs the full code to be profiled.
284284

285-
For the above fizzbuzz example it would be:
285+
For the above FizzBuzz example it would be:
286286

287287
```py
288288
%lprun -f fizzbuzz fizzbuzz(100)
@@ -522,7 +522,7 @@ From the profiling output it can be seen that lines 285-287 occupy over 90% of t
522522

523523
Given that the following line 289 only has a relative 0.6% time, it can be understood that the vast majority of times the condition `prey.life < PREY_HUNGER_THRESH` is evaluated it does not proceed.
524524

525-
Remembering that this method is executed once per each of the 5000 `Grass` agents each step of the model, it could make sense to pre-filter `prey_list` once each timestep before it is passed to `Grass::eaten()`. This would greatly reduce the number of `Prey` iterated, reducing the cost of the method.
525+
Remembering that this method is executed once per each of the 5000 `Grass` agents each step of the model, it could make sense to pre-filter `prey_list` once each time step before it is passed to `Grass::eaten()`. This would greatly reduce the number of `Prey` iterated, reducing the cost of the method.
526526

527527
:::::::::::::::::::::::::::::::::
528528
::::::::::::::::::::::::::::::::::::::::::::::::
@@ -532,7 +532,7 @@ Remembering that this method is executed once per each of the 5000 `Grass` agent
532532

533533
- Specific methods can be line-level profiled if decorated with `@profile` that is imported from `line_profiler`.
534534
- `kernprof` executes `line_profiler` via `python -m kernprof -lvr <script name> <arguments>`.
535-
- Code in global scope must wrapped in a method if it is to be profiled with `line_profiler`.
535+
- Code in global scope must be wrapped in a method if it is to be profiled with `line_profiler`.
536536
- The output from `line_profiler` lists the absolute and relative time spent per line for each targeted function.
537537

538538
::::::::::::::::::::::::::::::::::::::::::::::::

0 commit comments

Comments
 (0)