project-mahiwa / mahiwa-frontend-go

mahiwaのGo言語向けフロントエンド
https://pkg.go.dev/github.com/project-mahiwa/mahiwa-frontend-go
MIT License
0 stars 0 forks source link

[✨Feature]:素数判定の測定 #39

Closed usuyuki closed 10 months ago

usuyuki commented 10 months ago

✨ 概要

なぜ必要

備考

usuyuki commented 10 months ago

result

77214,
77214,
77211,
77214,
77213,

(77214+77214+ 77211+ 77214+ 77213)/5=77213.2

full

❯ m r-core2
pio run -t upload -e m5stack-core2
Processing m5stack-core2 (platform: espressif32; board: m5stack-core2; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/m5stack-core2.html
PLATFORM: Espressif 32 (6.4.0+sha.6186d2c) > M5Stack Core2
HARDWARE: ESP32 240MHz, 4.31MB RAM, 16MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 @ 3.20011.230801 (2.0.11) 
 - tool-esptoolpy @ 1.40501.0 (4.5.1) 
 - tool-mkfatfs @ 2.0.1 
 - tool-mklittlefs @ 1.203.210628 (2.3) 
 - tool-mkspiffs @ 2.230.0 (2.30) 
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 34 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Wasm3 @ 0.5.0
Building in release mode
Compiling .pio/build/m5stack-core2/src/lib/roader/wasm-roader.cpp.o
Linking .pio/build/m5stack-core2/firmware.elf
Retrieving maximum program size .pio/build/m5stack-core2/firmware.elf
Checking size .pio/build/m5stack-core2/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   2.4% (used 109440 bytes from 4521984 bytes)
Flash: [=         ]   6.9% (used 455457 bytes from 6553600 bytes)
Building .pio/build/m5stack-core2/firmware.bin
esptool.py v4.5.1
Creating esp32 image...
Merged 2 ELF sections
Successfully created esp32 image.
Configuring upload protocol...
AVAILABLE: cmsis-dap, esp-bridge, esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esptool
Looking for upload port...
Auto-detected: /dev/ttyUSB0
Uploading .pio/build/m5stack-core2/firmware.bin
esptool.py v4.5.1
Serial port /dev/ttyUSB0
Connecting....
Chip is ESP32-D0WDQ6-V3 (revision v3.0)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 24:0a:c4:f9:a4:cc
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00005fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x0007ffff...
Compressed 17536 bytes to 12202...
Writing at 0x00001000... (100 %)
Wrote 17536 bytes (12202 compressed) at 0x00001000 in 0.7 seconds (effective 195.5 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 146...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (146 compressed) at 0x00008000 in 0.1 seconds (effective 250.6 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.2 seconds (effective 390.0 kbit/s)...
Hash of data verified.
Compressed 455824 bytes to 231884...
Writing at 0x00010000... (6 %)
Writing at 0x0001c6e8... (13 %)
Writing at 0x0002848a... (20 %)
Writing at 0x00031910... (26 %)
Writing at 0x00036ad9... (33 %)
Writing at 0x0003c316... (40 %)
Writing at 0x000418d8... (46 %)
Writing at 0x00046cc3... (53 %)
Writing at 0x0004c54b... (60 %)
Writing at 0x00054c6a... (66 %)
Writing at 0x0005d632... (73 %)
Writing at 0x0006a8b1... (80 %)
Writing at 0x00071fbe... (86 %)
Writing at 0x00078ca2... (93 %)
Writing at 0x0007e5fc... (100 %)
Wrote 455824 bytes (231884 compressed) at 0x00010000 in 5.6 seconds (effective 653.5 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
=============================================================================================== [SUCCESS] Took 14.09 seconds ===============================================================================================

Environment    Status    Duration
-------------  --------  ------------
m5stack-core2  SUCCESS   00:00:14.092
=============================================================================================== 1 succeeded in 00:00:14.092 ===============================================================================================
make[1]: ディレクトリ '/opt/usuyuki/mahiwa_space/mahiwa-backend' に入ります
pio device monitor -b 115200
--- Terminal on /dev/ttyUSB0 | 115200 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
Project Mahiwa started🎉
ESP32 Mode
CPU Frequency:240 MHz
Project Mahiwa : WebAssembly launch
TinyGo mahiwa | prime
result: prime
time(micro): 77214
Project Mahiwa : WebAssembly done
usuyuki commented 10 months ago

TinyGoのopt=sでもzでもwebassemblyの結果変わらない

usuyuki commented 10 months ago

2147483647は素数

usuyuki commented 10 months ago

これtarget.jsonに指定したoptがちゃんと効いてないので測り直し

usuyuki commented 10 months ago

result

77211,
77211,
77215,
77211,
77214,

(77211+77211+ 77215+ 77211+ 77214)/5=77212.4≒77212

full

❯ m r-core2
pio run -t upload -e m5stack-core2
Processing m5stack-core2 (platform: espressif32; board: m5stack-core2; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/m5stack-core2.html
PLATFORM: Espressif 32 (6.4.0+sha.6186d2c) > M5Stack Core2
HARDWARE: ESP32 240MHz, 4.31MB RAM, 16MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 @ 3.20011.230801 (2.0.11) 
 - tool-esptoolpy @ 1.40501.0 (4.5.1) 
 - tool-mkfatfs @ 2.0.1 
 - tool-mklittlefs @ 1.203.210628 (2.3) 
 - tool-mkspiffs @ 2.230.0 (2.30) 
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 34 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Wasm3 @ 0.5.0
Building in release mode
Compiling .pio/build/m5stack-core2/src/lib/roader/wasm-roader.cpp.o
Linking .pio/build/m5stack-core2/firmware.elf
Retrieving maximum program size .pio/build/m5stack-core2/firmware.elf
Checking size .pio/build/m5stack-core2/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   2.5% (used 114000 bytes from 4521984 bytes)
Flash: [=         ]   7.0% (used 460017 bytes from 6553600 bytes)
Building .pio/build/m5stack-core2/firmware.bin
esptool.py v4.5.1
Creating esp32 image...
Merged 2 ELF sections
Successfully created esp32 image.
Configuring upload protocol...
AVAILABLE: cmsis-dap, esp-bridge, esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esptool
Looking for upload port...
Auto-detected: /dev/ttyUSB0
Uploading .pio/build/m5stack-core2/firmware.bin
esptool.py v4.5.1
Serial port /dev/ttyUSB0
Connecting....
Chip is ESP32-D0WDQ6-V3 (revision v3.0)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 24:0a:c4:f9:a4:cc
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00005fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x00080fff...
Compressed 17536 bytes to 12202...
Writing at 0x00001000... (100 %)
Wrote 17536 bytes (12202 compressed) at 0x00001000 in 0.7 seconds (effective 193.6 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 146...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (146 compressed) at 0x00008000 in 0.1 seconds (effective 267.4 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.2 seconds (effective 402.2 kbit/s)...
Hash of data verified.
Compressed 460384 bytes to 233643...
Writing at 0x00010000... (6 %)
Writing at 0x0001c6ef... (13 %)
Writing at 0x000283cd... (20 %)
Writing at 0x00031934... (26 %)
Writing at 0x00036b68... (33 %)
Writing at 0x0003c34f... (40 %)
Writing at 0x00041934... (46 %)
Writing at 0x00046cfc... (53 %)
Writing at 0x0004c58a... (60 %)
Writing at 0x00054cbe... (66 %)
Writing at 0x0005d61e... (73 %)
Writing at 0x0006a5a4... (80 %)
Writing at 0x0007280a... (86 %)
Writing at 0x00079643... (93 %)
Writing at 0x0007ee8f... (100 %)
Wrote 460384 bytes (233643 compressed) at 0x00010000 in 5.6 seconds (effective 652.3 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
=============================================================================================== [SUCCESS] Took 23.64 seconds ===============================================================================================

Environment    Status    Duration
-------------  --------  ------------
m5stack-core2  SUCCESS   00:00:23.636
=============================================================================================== 1 succeeded in 00:00:23.636 ===============================================================================================
make[1]: ディレクトリ '/opt/usuyuki/mahiwa_space/mahiwa-backend' に入ります
pio device monitor -b 115200
--- Terminal on /dev/ttyUSB0 | 115200 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
[   455][I][esp32-hal-psram.c:96] psramInit(): PSRAM enabled
Project Mahiwa started🎉
ESP32 Mode
CPU Frequency:240 MHz
Project Mahiwa : WebAssembly launch
TinyGo mahiwa | prime
result: prime
time(micro): 77211
Project Mahiwa : WebAssembly done