Skip to content

Commit 5a31eff

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

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

episodes/profiling-functions.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ As a stack it is a last-in first-out (LIFO) data structure.
4646

4747
![A diagram of a call stack](fig/stack.png){alt="A greyscale diagram showing a (call)stack, containing 5 stack frame. Two additional stack frames are shown outside the stack, one is marked as entering the call stack with an arrow labelled push and the other is marked as exiting the call stack labelled pop."}
4848

49-
When a function is called, a frame to track it's variables and metadata is pushed to the call stack.
49+
When a function is called, a frame to track its variables and metadata is pushed to the call stack.
5050
When that same function finishes and returns, it is popped from the stack and variables local to the function are dropped.
5151

5252
If you've ever seen a stack overflow error, this refers to the call stack becoming too large.
@@ -88,7 +88,7 @@ Hence, this prints the following call stack:
8888
traceback.print_stack()
8989
```
9090

91-
The first line states the file and line number where `a()` was called from (the last line of code in the file shown). The second line states that it was the function `a()` that was called, this could include it's arguments. The third line then repeats this pattern, stating the line number where `b2()` was called inside `a()`. This continues until the call to `traceback.print_stack()` is reached.
91+
The first line states the file and line number where `a()` was called from (the last line of code in the file shown). The second line states that it was the function `a()` that was called, this could include its arguments. The third line then repeats this pattern, stating the line number where `b2()` was called inside `a()`. This continues until the call to `traceback.print_stack()` is reached.
9292

9393
You may see stack traces like this when an unhandled exception is thrown by your code.
9494

@@ -102,7 +102,7 @@ You may see stack traces like this when an unhandled exception is thrown by your
102102
[`cProfile`](https://docs.python.org/3/library/profile.html#instant-user-s-manual) is a function-level profiler provided as part of the Python standard library.
103103

104104
<!-- How is it used? -->
105-
It can be called directly within your Python code as an imported package, however it's easier to use it's script interface:
105+
It can be called directly within your Python code as an imported package, however it's easier to use its script interface:
106106

107107
```sh
108108
python -m cProfile -o <output file> <script name> <arguments>
@@ -199,9 +199,9 @@ In the icicle visualization style functions are represented by rectangles. A roo
199199
-->
200200

201201
The icicle diagram displayed by `snakeviz` represents an aggregate of the call stack during the execution of the profiled code.
202-
The box which fills the top row represents the the root call, filling the row shows that it occupied 100% of the runtime.
202+
The box which fills the top row represents the root call, filling the row shows that it occupied 100% of the runtime.
203203
The second row holds the child methods called from the root, with their widths relative to the proportion of runtime they occupied.
204-
This continues with each subsequent row, however where a method only occupies 50% of the runtime, it's children can only occupy a maximum of that runtime hence the appearance of "icicles" as each row gets narrower when the overhead of methods with no further children is accounted for.
204+
This continues with each subsequent row, however where a method only occupies 50% of the runtime, its children can only occupy a maximum of that runtime hence the appearance of "icicles" as each row gets narrower when the overhead of methods with no further children is accounted for.
205205

206206
By clicking a box within the diagram, it will "zoom" making the selected box the root allowing more detail to be explored. The diagram is limited to 10 rows by default ("Depth") and methods with a relatively small proportion of the runtime are hidden ("Cutoff").
207207

@@ -213,7 +213,7 @@ As you hover each box, information to the left of the diagram updates specifying
213213

214214
If you're more familiar with writing Python inside Jupyter notebooks you can still use `snakeviz` directly from inside notebooks using the notebooks "magic" prefix (`%`) and it will automatically call `cProfile` for you.
215215

216-
First `snakeviz` must be installed and it's extension loaded.
216+
First `snakeviz` must be installed and its extension loaded.
217217

218218
```py
219219
!pip install snakeviz
@@ -239,7 +239,7 @@ my_function()
239239

240240
In both cases, the full `snakeviz` profile visualisation will appear as an output within the notebook!
241241

242-
*You may wish to right click the top of the output, and select "Disable Scrolling for Outputs" to expand it's box if it begins too small.*
242+
*You may wish to right click the top of the output, and select "Disable Scrolling for Outputs" to expand its box if it begins too small.*
243243

244244
:::::::::::::::::::::::::::::::::::::::::::::
245245

@@ -323,7 +323,7 @@ As `time.sleep()` is a core Python method it is displayed as "built-in method" a
323323

324324
If you hover any boxes representing the methods from the above code, you will see file and line properties completed. The directory property remains empty as the profiled code was in the root of the working directory. A profile of a large project with many files across multiple directories will see this filled.
325325

326-
Find the box representing `c_2()` on the icicle diagram, it's children are unlabelled because they are not wide enough (but they can still be hovered). Clicking `c_2()` zooms in the diagram, showing the children to be `time.sleep()` and `d_1()`.
326+
Find the box representing `c_2()` on the icicle diagram, its children are unlabelled because they are not wide enough (but they can still be hovered). Clicking `c_2()` zooms in the diagram, showing the children to be `time.sleep()` and `d_1()`.
327327

328328
To zoom back out you can either click the top row, which will zoom out one layer, or click "Reset Zoom" on the left-hand side.
329329

0 commit comments

Comments
 (0)