docs update!

This commit is contained in:
shenjack 2022-11-22 11:43:46 +08:00
parent e6a2b7b36c
commit b86dcb50cc
17 changed files with 197 additions and 18 deletions

View File

@ -18,6 +18,7 @@ import platform
import traceback
import threading
import multiprocessing
from pathlib import Path
from typing import Optional, TextIO
# import psutil
@ -72,8 +73,11 @@ def to_code(string: str):
def write_markdown_tablet(crash_file: TextIO, tablet: list) -> None:
a_len, b_len, c_len = tablet[1:4]
...
a_len = max(tablet[1], 6)
b_len = max(tablet[2], 5)
c_len = max(tablet[3], 10)
crash_file.write(f'\n| Option{" " * (a_len - 4)}| Value{" " * (b_len[2] - 3)} | Value Type{" " * (c_len[3] - 8)} |\n')
crash_file.write(f'|:{"-" * (a_len + 3)}|:{"-" * (b_len + 3)}|:{"-" * (c_len + 3)}|\n')
def create_crash_report(info: str = None) -> None:
@ -94,7 +98,7 @@ def create_crash_report(info: str = None) -> None:
cache_stream.write(markdown_line_handler(f'DR Version: {Difficult_Rocket.game_version}', level=1))
cache_stream.write(markdown_line_handler(f'DR language: {DR_runtime.language}', level=1))
cache_stream.write(markdown_line_handler(f'Running Dir: {os.path.abspath(os.curdir)}', level=1))
cache_stream.write(markdown_line_handler(f'Running Dir: {Path(os.curdir).resolve()}', level=1))
option_with_len = DR_runtime.option_with_len()
option_with_len[1] = max(option_with_len[1], 6)
option_with_len[2] = max(option_with_len[2], 5)
@ -146,6 +150,8 @@ def create_crash_report(info: str = None) -> None:
cache_stream.write(markdown_line_handler(f'processor: {to_code(platform.processor())}', level=1))
cache_stream.write(markdown_line_handler(f'release: {to_code(platform.release())}', level=1))
cache_stream.write(markdown_line_handler(f'version: {to_code(platform.version())}', level=1))
except io.BlockingIOError:
raise
finally:
get_cache = cache_stream.getvalue()
with open('./crash_report/{}'.format(filename), 'w+', encoding='utf-8') as crash_file:

View File

@ -0,0 +1,181 @@
# nuitka 1.2.1 的性能测试
大家好! 这里是shenjack
这篇文章就是 [B站](还没发出来呢) 专栏的原文!
# 综述
## 环境
- 硬件
- CPU: `AMD R5 5600X`
- 内存: `64G DDR4 3200 (32×2)`
- 软件
- ![gcc clang](gcc_clang_version.png)
- ![python nuitka](python_nuitka_version.png)
- ![DR](DR_git_commit.png)
- `gcc 12.2.0`
- `clang 14.0.6`
- `nuitka v1.2.1`
- `Python 3.8.10`
- [DR](https://github.com/shenjackyuanjie/Difficult-Rocket) commit `e6a2b7b36cc98e508efbc61c4646181f5817fc7c`
## 编译选项
- 核心编译选项
- 环境
- `--standalone`
- 将环境一并打包进完成的文件夹中
- ```
--standalone Enable standalone mode for output. This allows you to
transfer the created binary to other machines without
it using an existing Python installation. This also
means it will become big. It implies these option: "--
follow-imports" and "--python-flag=no_site". Defaults
to off.```
- 编译器
- `--clang`
- 强制使用 `clang` 编译器
- ```
--clang Enforce the use of clang. On Windows this requires a
working Visual Studio version to piggy back on.
Defaults to off.```
- `--mingw64` (常量)
- 强制使用 `mingw64` 编译器
- ```
--mingw64 Enforce the use of MinGW64 on Windows. Defaults to
off.```
- `--jobs=24` (常量)
- 最多同时运行的 C 编译器 `(clang|mingw64)` 数量
- ```
-j N, --jobs=N Specify the allowed number of parallel C compiler
jobs. Defaults to the system CPU count.```
- `--lto=` `yes|no|auto(None)`
- 是否启用 链接
- ```
--lto=choice Use link time optimizations (MSVC, gcc, clang).
Allowed values are "yes", "no", and "auto" (when it's
known to work). Defaults to "auto".```
- `--disable-ccache`
- 不使用 `ccache` 或者 `clcache` 的缓存
- ```
--disable-ccache Do not attempt to use ccache (gcc, clang, etc.) or
clcache (MSVC, clangcl).```
## 结论综述
`ccache` 的情况下 `clang` 的性能略微落后于 `mingw64`
TODO
# 原始数据
## 因为视频使用CPU编码所以很多数据没法看到这里使用的是后面再次测试/微信群内存档的数据
## 视频应该会再次测试,数据可能不同,请谅解(obs更新完没注意编码啊啊啊啊)
<table>
<tr>
<th>编译器</th> <th colspan="2">有ccache</th> <th colspan="2">无ccache</th>
</tr>
<tr>
<th>编译器</th> <th>lto=no</th> <th>lto=yes</th> <th>lto=no</th> <th>lto=yes</th>
</tr>
<tr>
<td>clang</td> <td>50s</td> <td>86s</td> <td>83s</td> <td>67s</td>
</tr>
<tr>
<td>gcc</td> <td>59s</td> <td>641s</td> <td>227s</td> <td>630s</td>
</tr>
</table>
- `clang`
- `with ccache`
- `lto=no`
- `视频内数据`
- `--clang`
- `--mingw64`
- `--lto=no`
- 耗时: 50000ms (50s)
- ![clang mingw lto no ccache](clang_mingw_lto_no_ccache.png)
- `lto=yes`
- `后期测试数据`
- `--clang`
- `--mingw64`
- `--lto=yes`
- 耗时 86000ms (86s)
- ![clang mingw lto yes ccache](clang_mingw_lto_yes_ccache.png)
- `no ccache`
- `lto=no`
- `视频内数据`
- `--clang`
- `--mingw64`
- `--lto=no`
- `--disable-ccache`
- 耗时 83000ms (83s)
- ![clang mingw lto no](clang_mingw_lto_no.png)
- `lto=yes`
- `后期测试数据`
- `--clang`
- `--mingw64`
- `--lto=yes`
- `--disable-ccache`
- 耗时 67000ms (67s)
- ![clang mingw lto yes](clang_mingw_lto_yes.png)
- `mingw64`
- `with ccache`
- `lto=no`
- `后期测试数据`
- `--mingw64`
- `--lto=no`
- 耗时 59000ms (59s)
- ![mingw lto no ccache](mingw_lto_no_ccache.png)
- `lto=yes`
- `后期测试数据`
- `--mingw64`
- `--lto=yes`
- 耗时 641000ms (641s) (10.68min)
- ![mingw lto yes ccache](mingw_lto_yes_ccache.png)
- `no ccache`
- `lto=no`
- `视频内数据`
- `--mingw64`
- `--lto=no`
- `--disable-ccache`
- 耗时 227000ms (227s) (3.78min)
- ![mingw lto no](mingw_lto_no.png)
- `lto=yes`
- `后期测试数据`
- `--mingw64`
- `--lto=yes`
- `--disable-ccache`
- 耗时 630000ms (630s) (10.5min)
- ![mingw lto yes](mingw_lto_yes.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

View File

@ -18,11 +18,3 @@ pyglet 坐标轴原点是左上角
[背景候选1号](background.png)
来自 @底层萌新 QQ1744251171
| 项目 | 油麦菜 | 小白菜 | 绿萝 |
| :----: | :----: | :----: | :----: |
| 对照组 | 882 | 625 | 117 |
| 40° (高温) | --- | 646 | --- |
| 50° (高温) | 639 | 580 | --- |
| 60° (高温) | 1094 | 400 | --- |
| 70° (高温) | 674 | 1054 | --- |

View File

@ -21,7 +21,7 @@
- 咕了好久的 update log 了
- github copilot 卒了,所以没有英文
- GitHub copy alot break , so no English
- GitHub copy alot break , so no more English
### Change

View File

@ -1,11 +1,11 @@
$start_time = Get-Uptime
Write-Output $start_time
python3.8.exe -m nuitka --jobs=24 --clang --mingw64 --lto=no --show-memory --show-progress --output-dir=build/nuitka1 --include-data-dir=./configs=./configs --include-data-dir=./libs/fonts=./libs/fonts --include-data-dir=./textures=./textures --include-data-dir=./libs/pyglet=./pyglet --enable-plugin=numpy --nofollow-import-to=objprint,numpy,pillow,cffi,PIL,pyglet --standalone $args .\DR.py
python3.8.exe -m nuitka --jobs=24 --clang --lto=yes --mingw64 --show-memory --show-progress --output-dir=build/nuitka1 --include-data-dir=./configs=./configs --include-data-dir=./libs/fonts=./libs/fonts --include-data-dir=./textures=./textures --include-data-dir=./libs/pyglet=./pyglet --enable-plugin=numpy --nofollow-import-to=objprint,numpy,pillow,cffi,PIL,pyglet --standalone $args .\DR.py
$end_time = Get-Uptime
$out = $end_time.TotalMilliseconds - $start_time.TotalMilliseconds
Write-Output $end_time.TotalSeconds $start_time.TotalSeconds $out
Write-Output $end_time.TotalSeconds $start_time.TotalSeconds $out s
Write-Output $start_time $end_time
Write-Output "--jobs=24 --clang --mingw64 --lto=no and $args"
Write-Output "--jobs=24 --clang --mingw64 --lto=yes and ($args)"
# --include-data-dir=./libs/pyglet=./pyglet
# --run
# --disable-ccache

View File

@ -1,11 +1,11 @@
$start_time = Get-Uptime
Write-Output $start_time
python3.8.exe -m nuitka --jobs=24 --mingw64 --lto=no --show-memory --show-progress --output-dir=build/nuitka1 --include-data-dir=./configs=./configs --include-data-dir=./libs/fonts=./libs/fonts --include-data-dir=./textures=./textures --include-data-dir=./libs/pyglet=./pyglet --enable-plugin=numpy --nofollow-import-to=objprint,numpy,pillow,cffi,PIL,pyglet --standalone $args .\DR.py
python3.8.exe -m nuitka --jobs=24 --mingw64 --lto=no --disable-ccache --show-memory --show-progress --output-dir=build/nuitka1 --include-data-dir=./configs=./configs --include-data-dir=./libs/fonts=./libs/fonts --include-data-dir=./textures=./textures --include-data-dir=./libs/pyglet=./pyglet --enable-plugin=numpy --nofollow-import-to=objprint,numpy,pillow,cffi,PIL,pyglet --standalone $args .\DR.py
$end_time = Get-Uptime
$out = $end_time.TotalMilliseconds - $start_time.TotalMilliseconds
Write-Output $end_time.TotalSeconds $start_time.TotalSeconds $out
Write-Output $end_time.TotalSeconds $start_time.TotalSeconds $out s
Write-Output $start_time $end_time
Write-Output "--jobs=24 --mingw64 --lto=no and $args"
Write-Output "--jobs=24 --mingw64 --lto=no --disable-ccache and $args"
# --include-data-dir=./libs/pyglet=./pyglet
# --run
# --disable-ccache