docs update

This commit is contained in:
blueloveTH 2023-10-14 16:58:32 +08:00
parent 3d332a694f
commit 0aef0c8a01
5 changed files with 40 additions and 53 deletions

View File

@ -143,6 +143,14 @@ Performance results for cpython 3.9 are applicable to for pkpy.
See https://pocketpy.dev/performance/ for details.
These are the results of the primes benchmark, which *roughly* reflects the performance among lua, cpython and pkpy.
| name | version | time | file |
| ---- | ---- | ---- | ---- |
| lua | 5.3.3 | `1.576s ■■■■■■■■■□□□□□□□` | [benchmarks/primes.lua](https://github.com/blueloveTH/pocketpy/blob/3d332a694f99ae2d327e732e7f3e3215bedcb069/benchmarks/primes.lua) |
| pocketpy | 1.2.7 | `2.385s ■■■■■■■■■■■■■□□□` | [benchmarks/primes.py](https://github.com/blueloveTH/pocketpy/blob/3d332a694f99ae2d327e732e7f3e3215bedcb069/benchmarks/primes.py) |
| cpython | 3.8.10 | `2.871s ■■■■■■■■■■■■■■■■` | [benchmarks/primes.py](https://github.com/blueloveTH/pocketpy/blob/3d332a694f99ae2d327e732e7f3e3215bedcb069/benchmarks/primes.py) |
## Used By
| | Description |
@ -165,7 +173,7 @@ All kinds of contributions are welcome.
- any suggestions
- any questions
If you find pocketpy useful, consider star this repository (●'◡'●)
If you find pkpy useful, consider star this repository (●'◡'●)
## Sponsor me

View File

@ -1,49 +0,0 @@
set_project("pocketpy")
set_allowedplats("windows", "linux", "macosx", "wasm", "android")
option("dev", {default = true, showmenu = true, description = ""})
includes("dylib")
add_requires("python", {kind = "binary"})
add_rules("mode.debug", "mode.release")
set_languages("c++17")
add_cxflags("/utf-8", {tools = "cl"})
add_includedirs("include")
if is_plat("linux", "macosx") then
add_syslinks("dl")
end
target("pocketpy")
if has_config("dev") then
set_kind("shared")
else
set_kind("$(kind)")
end
add_files("src/*.cpp")
add_headerfiles("include/(**.h)")
if is_plat("windows") and is_kind("shared") then
add_rules("utils.symbols.export_all")
end
before_build(function (target)
local python = assert(import("lib.detect.find_tool")("python3"), "python3 not found!")
os.execv(python.program, {"prebuild.py"})
end)
target("main")
set_kind("binary")
add_files("src2/main.cpp")
add_deps("pocketpy")
on_load(function (target)
target:set("enabled", has_config("dev"))
end)

View File

@ -43,7 +43,7 @@ These platforms are officially tested.
## Star the repo
If you find pocketpy useful, consider [star this repository](https://github.com/blueloveth/pocketpy) (●'◡'●)
If you find pkpy useful, consider [star this repository](https://github.com/blueloveth/pocketpy) (●'◡'●)
## Sponsor me

View File

@ -127,3 +127,31 @@ ALL TESTS PASSED
```
See [actions/runs](https://github.com/blueloveTH/pocketpy/actions/runs/6511071423/job/17686074263).
## Primes benchmarks
These are the results of the primes benchmark.
| name | version | time | file |
| ---- | ---- | ---- | ---- |
| lua | 5.3.3 | `1.576s ■■■■■■■■■□□□□□□□` | [benchmarks/primes.lua](https://github.com/blueloveTH/pocketpy/blob/3d332a694f99ae2d327e732e7f3e3215bedcb069/benchmarks/primes.lua) |
| pocketpy | 1.2.7 | `2.385s ■■■■■■■■■■■■■□□□` | [benchmarks/primes.py](https://github.com/blueloveTH/pocketpy/blob/3d332a694f99ae2d327e732e7f3e3215bedcb069/benchmarks/primes.py) |
| cpython | 3.8.10 | `2.871s ■■■■■■■■■■■■■■■■` | [benchmarks/primes.py](https://github.com/blueloveTH/pocketpy/blob/3d332a694f99ae2d327e732e7f3e3215bedcb069/benchmarks/primes.py) |
```sh
$ time lua benchmarks/primes.lua
real 0m1.576s
user 0m1.514s
sys 0m0.060s
$ time ./main benchmarks/primes.py
real 0m2.385s
user 0m2.247s
sys 0m0.100s
$ time python benchmarks/primes.py
real 0m2.871s
user 0m2.798s
sys 0m0.060s
```

View File

@ -182,4 +182,4 @@ delegate object NativeFuncC(VM vm, object[] args);
+ `CSharpLambda BindFunc(PyObject obj, string name, int argc, NativeFuncC f)`
It is similar to `bind_func` in [C++ API](../quick-start/bind/).
It is similar to `bind_func` in [C++ API](../bindings/).