Browse Source

Profile

pull/10/head
Jure Šorn 6 years ago
parent
commit
7faf16db85
1 changed files with 18 additions and 10 deletions
  1. 28
      README.md

28
README.md

@ -982,15 +982,6 @@ from collections import deque
```
Hashlib
-------
```python
>>> import hashlib
>>> hashlib.md5(<str>.encode()).hexdigest()
'33d0eba106da4d3ebca17fcd3f4c3d77'
```
Threading
---------
```python
@ -1014,6 +1005,15 @@ lock.release()
```
Hashlib
-------
```python
>>> import hashlib
>>> hashlib.md5(<str>.encode()).hexdigest()
'33d0eba106da4d3ebca17fcd3f4c3d77'
```
Itertools
---------
**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
### Basic
```python
from time import time
start_time = time()
start_time = time() # Seconds since Epoch.
...
duration = time() - start_time
```
### High Performance
```python
from time import perf_counter as pc
start_time = pc() # Seconds since restart.
...
duration = pc() - start_time
```
### Timing a Snippet
```python
from timeit import timeit

Loading…
Cancel
Save