update docs

This commit is contained in:
blueloveTH 2024-02-11 18:26:18 +08:00
parent d166766ebf
commit 6eb2fa3ba1
3 changed files with 59 additions and 1 deletions

19
docs/modules/array2d.md Normal file
View File

@ -0,0 +1,19 @@
---
icon: package
label: array2d
---
Efficient general-purpose 2D array.
https://github.com/pocketpy/pocketpy/blob/main/include/typings/array2d.pyi
## Example
```python
from array2d import array2d
a = array2d(3, 4, default=0)
a[1, 2] = 5
print(a[1, 2]) # 5
```

View File

@ -0,0 +1,39 @@
---
icon: package
label: line_profiler
---
Line-by-line profiler for Python.
## Example
```python
from line_profiler import LineProfiler
def my_func():
a = 0
for i in range(1000000):
a += i
return a
lp = LineProfiler()
lp.add_function(my_func)
lp.runcall(my_func)
lp.print_stats()
```
```txt
Total time: 0.243s
File: 84_line_profiler.py
Function: my_func at line 3
Line # Hits Time Per Hit % Time Line Contents
==============================================================
3 def my_func():
4 1 0 0 0.0 a = 0
5 1000001 69 0 28.4 for i in range(1000000):
6 1000001 174 0 71.6 a += i
7 1 0 0 0.0 return a
```

View File

@ -3,7 +3,7 @@ output: .retype
url: https://pocketpy.dev
branding:
title: pocketpy
label: v1.4.0
label: v1.4.1
logo: "./static/logo.png"
favicon: "./static/logo.png"
meta: