Skip to content

healeycodes/andjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

andjs

My blog post: Building a Runtime with QuickJS


A tiny JavaScript runtime in C built on top of QuickJS with with an event loop and a worker pool, with the following APIs:

  • console.log
  • process.uptime()
  • setTimeout
  • clearTimeout
  • fs.readFileSync
  • fs.readFile

See examples/ for JavaScript code examples.

./init.sh  # download vendored quickjs source
make       # builds ./andjs
./andjs examples/example-read-file-async.js # run some js!

There are also some benchmarks against Node.js.

./benchmark.sh  # ran on M1 Pro, Node.js v24.14.0
tmpdir: /var/folders/61/lbcm8sq51g7fjcvsk6hhz0q00000gn/T//andjs-bench.QmMzJq
files: 10 x 1 MiB UTF-8 text
iterations: 10

Overall time (includes startup):
node  38.9 ms ± 1.0 ms
andjs 6.9 ms ± 0.4 ms

andjs is 5.67x faster overall

File-read portion:
node  4.242 ms
andjs 4.754 ms

Also, tests.

./init.sh
./test.sh

About

🏃 A tiny JavaScript runtime built on QuickJS with timers, file I/O, an event loop, and a worker pool.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors