Let's build web pages by rust
& js
!
- Test the efficency of wasm, using Rust in browser.
- Create a scaffold, using Rust and Web Worker, for future web development.
A type of machine code for browser to handle time waste jobs, which can assembly from multiple programming language.
A non-block calculation in browser implement with web worker
, mean while, we can use wasm
to handle time waste job.
All for a better experience of web site.
Algorithm | Size | Count | Pure Javascript(ms) | Rust in warm(ms) |
---|---|---|---|---|
MD5 | 50000 | 1000 | 2409 | 521 |
bubble | 20000 | 1 | 821 | 1095 |
QuickSort | 20000 | 1 | 9 | 3 |
Standard | 20000 | 1 | 4 | 2 |
Bubble | 200000 | 1 | 99549 | 114333 |
QuickSort | 200000 | 1 | 22 | 36 |
Standard | 200000 | 1 | 51 | 26 |
MD5 | 500000 | 1000 | 24344 | 4866 |
🧵 Worker
Web Workers
is a simulated multi-thread environment in browser.
- No block to main thread.
- Asynchronous communication.
- More efficient.
- ...
🐂 Rxjs
A paradigm of programming, functional and reactive. It's a perspective of time, we handle data and event during all the time. A different perspective for dealing with data flow and event.
- Functional
- Reactive
- operators
- handle complex events
- Synchronous or Asynchronous.
- Broadcast
- ...
😋 Rust
Rust is a language for future with many advanced programming tech.
From offical site:
A language empowering everyone to build reliable and efficient software.
-
Performance Rust is blazingly fast and memory-efficient: with no runtime or garbage collector, it can power performance-critical services, run on embedded devices, and easily integrate with other languages.
-
reliable Rust’s rich type system and ownership model guarantee memory-safety and thread-safety — enabling you to eliminate many classes of bugs at compile-time.
-
Productivity Rust has great documentation, a friendly compiler with useful error messages, and top-notch tooling — an integrated package manager and build tool, smart multi-editor support with auto-completion and type inspections, an auto-formatter, and more.
My opinion: It's kind of wierd to use rust for frontend developer who using javascript all the time.
- struct | trait | type
- ownership
- multi-thread
- so on
But we can take nourishment from comprehensive documentation by offical. Those advanced techs.
Not a bad trial for full-stack engineer to use Rust(server / wasm
)。
wasm-bindgen
wasm-bindgen-futures
js-sys
web-sys
console_error_panic_hook
console_log
wee_alloc
parity-wasm
wasmparser
wasmi
cranelift-wasm
wasm-pack
wasm-opt
wasm2js
wasm-gc
wasm-snip
twiggy
wasm-objdump
wasm-nm
- import
c
module(.h
) - File system | IO
- multi-thread
- Algorithm
- Image processing
- Basic data structure.
- Text processing
- Game application