Skip to content

Commit 7faf16d

Browse files
committed
Profile
1 parent 6c9828a commit 7faf16d

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

README.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -982,15 +982,6 @@ from collections import deque
982982
```
983983

984984

985-
Hashlib
986-
-------
987-
```python
988-
>>> import hashlib
989-
>>> hashlib.md5(<str>.encode()).hexdigest()
990-
'33d0eba106da4d3ebca17fcd3f4c3d77'
991-
```
992-
993-
994985
Threading
995986
---------
996987
```python
@@ -1014,6 +1005,15 @@ lock.release()
10141005
```
10151006

10161007

1008+
Hashlib
1009+
-------
1010+
```python
1011+
>>> import hashlib
1012+
>>> hashlib.md5(<str>.encode()).hexdigest()
1013+
'33d0eba106da4d3ebca17fcd3f4c3d77'
1014+
```
1015+
1016+
10171017
Itertools
10181018
---------
10191019
**Every function returns an iterator and can accept any collection and/or iterator. If you want to print the iterator, you need to pass it to the list() function!**
@@ -1520,11 +1520,19 @@ Profile
15201520
### Basic
15211521
```python
15221522
from time import time
1523-
start_time = time()
1523+
start_time = time() # Seconds since Epoch.
15241524
...
15251525
duration = time() - start_time
15261526
```
15271527

1528+
### High Performance
1529+
```python
1530+
from time import perf_counter as pc
1531+
start_time = pc() # Seconds since restart.
1532+
...
1533+
duration = pc() - start_time
1534+
```
1535+
15281536
### Timing a Snippet
15291537
```python
15301538
from timeit import timeit

0 commit comments

Comments
 (0)