https://github.com/fabiosantoscode/quickjs-precompiler
Speed up javascript: compile some JS to C, the rest will use quickjs
https://github.com/fabiosantoscode/quickjs-precompiler
Last synced: 4 days ago
JSON representation
Speed up javascript: compile some JS to C, the rest will use quickjs
- Host: GitHub
- URL: https://github.com/fabiosantoscode/quickjs-precompiler
- Owner: fabiosantoscode
- Created: 2024-11-09T11:31:04.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-28T12:28:36.000Z (about 1 year ago)
- Last Synced: 2026-02-22T17:32:44.754Z (4 months ago)
- Language: TypeScript
- Size: 2.1 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# quickjs-precompiler
Precompiles your JavaScript files into C with quickjs embedded.
Note: quickjs can already output C files containing your JS turned into bytecode, but this aims to provide a faster version of this by creating C files that mirror your actual JS.
# Internal design
Firstly, the JS is parsed with Acorn, producing the ESTree AST. This is a standard format for JavaScript ASTs.
Then, we turn the ESTree AST into our internal precomp-AST. The precomp-AST is fully convertible into C with quickJS calls.
In the future, there may be a step to optimize the precomp-AST by utilizing type information.
Finally, the precomp-AST is output into C source code.
# Roadmap
- Optimize written functions per-type
- Extend your code with C functions
- Precompile the generated code with TCC
# Hacking
This contains a git submodule vendor/quickjs checked out at a specific commit. You need to compile this in order to use quickjs-precompiler.
```
cd vendor/quickjs; make; make quickjs.o
```