PrimJS is a lightweight, high-performance JavaScript engine designed specifically for the Lynx cross-platform framework. Fully supporting ES2019, PrimJS is built on top of QuickJS and delivers superior performance and a better development experience compared to QuickJS.
- Optimized Interpreter: PrimJS introduces a template interpreter leveraging stack caching and register optimizations, significantly enhancing performance.
- Seamless Object Model Integration: The engine's object model integrates efficiently with the Lynx object model, reducing data communication overhead and improving rendering performance.
- Advanced Memory Management: Utilizing a Garbage Collector (GC) instead of QuickJS's Reference Counting, PrimJS offers better performance, improved memory analyzability, and reduced risk of memory leaks.
- Comprehensive Debugging Support: Full implementation of the Chrome DevTools Protocol (CDP) enables seamless integration with Chrome Debugger for enhanced debugging capabilities.
For detailed performance benchmarks, please refer to performance comparison document. The benchmark results show that PrimJS outperforms QuickJS by approximately 28% in overall score (3735 vs 2904) on the Octane Benchmark suite. We are continuously working on performance optimizations.
-
Clone the repository:
git clone [email protected]:lynx-family/primjs.git
-
Install dependencies:
cd primjs source tools/envsetup.sh hab sync .
PrimJS uses gn
and ninja
for building. Follow these steps to generate the qjs
binary:
gn gen out/Default
ninja -C out/Default qjs_exe
To enable the template interpreter and garbage collector, use the following gn
arguments (for example, on the arm64 platform, these arguments configure the build system to target ARM64 architecture while enabling the bytecode-based template interpreter and automatic memory management):
gn gen out/Default --args= '
target_cpu="arm64"
enable_primjs_snapshot = true
enable_compatible_mm = true
enable_tracing_gc = true'
ninja -C out/Default -j32 qjs_exe
For a release build, set the is_debug = false
argument during configuration.
The primary binary is qjs
, located at out/Default/qjs
. Use it to run JavaScript files:
./out/Default/qjs test.js
Run the following steps from the root directory to build and execute unit tests:
python3 tools/ci/check_test_build.py
python3 tools/ci/check_test_run.py
We are devoted to ensuring a positive, inclusive, and safe environment for all contributors. Please find our Code of Conduct for detailed information.
We welcome you to join and become a member of Lynx Authors. It's people like you that make this project great.
Please refer to lynx contributing guide for details.
Large discussions and proposals are discussed in Github Discussions
PrimJS is Apache licensed, as found in the LICENSE file.