pmp-p / micropython-ports-wasm

*experimental* wasm micropython port *not a fork* for Pythons Everywhere
http://pmp-p.github.io/layout.html
37 stars 1 forks source link

Load time and download size ?!? #9

Open jedie opened 3 years ago

jedie commented 3 years ago

Because I just stumbled across https://github.com/pyodide/pyodide/issues/646

What's the final download size ?

pmp-p commented 3 years ago

Note that the final product is not MicroPython but "WaPy" a spinoff based on the no_nlr (non working in its current state) personnal branch from original author.

Modifications are simple though it may look like heavy changes see https://github.com/pmp-p/wapy/tree/wapy-emsdk.

The final size can be as low as 188 KiB in wasm uncompressed form as that's what i was using to try to start on wasm3+esp32 until i see that there's some problems with wasm design wrt microcontrollers ecosystems. Note that performance could be horrible (because of -Os ) i did not test yet.

Anyway In that you still have parser, compiler and interpreter, but not the native ffi C/C++ glue you would need for dynamic modules or the fancy emscripten stdlib. You only have WASI there ( only fd but that is what plan9 use no ?).

A slightly larger version ( with bugs ) is available here https://pmp-p.github.io/wasi/wapy.html which you can build yourself with https://github.com/pmp-p/wapy-pack

it still a work in progress there's a few tests ( though not all are relevant for web ) not passing

755 tests performed (20562 individual testcases)
735 tests passed
99 tests skipped: builtin_help builtin_range_binop class_delattr_setattr class_inplace_op2 fun_globals generator_pend_throw io_buffered_writer memoryview_itemsize namedtuple_asdict sys_getsizeof cmd_parsetree repl_words_move framebuf1 framebuf16 framebuf2 framebuf4 framebuf8 framebuf_subclass machine_timer uasyncio_threadsafeflag ucryptolib_aes128_ctr urandom_extra urandom_extra_float urandom_seed_default ure_debug ure_groups ure_span ure_sub ure_sub_unmatched vfs_basic vfs_blockdev vfs_fat_fileio1 vfs_fat_fileio2 vfs_fat_finaliser vfs_fat_more vfs_fat_mtime vfs_fat_oldproto vfs_fat_ramdisk vfs_fat_ramdisklarge vfs_lfs vfs_lfs_corrupt vfs_lfs_error vfs_lfs_file vfs_lfs_mount vfs_lfs_mtime vfs_lfs_superblock vfs_posix vfs_userfs math_factorial_intbig resource_stream heap_locked import_mpy_invalid import_mpy_native_gc import_mpy_native_x64 native_closure native_const native_const_intbig native_for native_gen native_misc native_try native_try_deep native_with schedule viper_addr viper_args viper_binop_arith viper_binop_arith_uint viper_binop_bitwise_uint viper_binop_comp viper_binop_comp_imm viper_binop_comp_uint viper_binop_divmod viper_binop_multi_comp viper_cond viper_const viper_const_intbig viper_error viper_globals viper_import viper_misc viper_misc_intbig viper_ptr16_load viper_ptr16_store viper_ptr32_load viper_ptr32_store viper_ptr8_load viper_ptr8_store viper_subscr viper_try viper_types viper_with sys_settrace_features sys_settrace_generator sys_settrace_loop extra_coverage ffi_callback ffi_float ffi_float2
20 tests failed: class_bind_self generator_name int1 int_big1 op_error python36 string1 string_pep498_fstring cmd_showbc cmd_verbose btree_error machine1 ure1 ussl_basic utime_time_ns cmath_fun float2int_doubleprec_intbig file1 qstr_limit unicode_subscr
jedie commented 1 year ago

Seems that there is a new project that tried to fix this problem by using MicroPython: https://github.com/pyscript/MicroPyScript It's around 300k to download.

A DEMO is here: https://pyscript.net/tech-preview/micropython/index.html

See also: https://talkpython.fm/episodes/show/391/pyscript-powered-by-micropython

pmp-p commented 1 year ago

Thanks for the sum up

Afaik from the talks i already engaged on pyscript discord with mainteners. pyscript will most likely have multiple runtimes in the future. Personnally i see those as : The official experimental ones : pyodide and possibly pyodide+SDL2/WebGL ( pygame / 3D ) and the (very) experimental : micropython and possibly WaPy (soft-RT)

i guess @ntoll should setup a testsuite runner asap, afaik micropython javascript port did not receive extra care since a long time. Most concerning problems were probably GC and lack of standardized DOM access ( either sync or async ).

i hope DOM and events stuff on the "light" runtimes will be able to follow pyscript conventions.

hint for testing GC, remove -sALLOW_MEMORY_GROWTH and set -s TOTAL_MEMORY= to something low