Skip to content

modernc-quickjs: run pending jobs after evaluating a script - #41

Open
j-modernc-org wants to merge 1 commit into
ivankra:mainfrom
j-modernc-org:modernc-quickjs-run-jobs
Open

j-modernc-org wants to merge 1 commit into
ivankra:mainfrom
j-modernc-org:modernc-quickjs-run-jobs

Conversation

@j-modernc-org

Copy link
Copy Markdown

The modernc-quickjs runner evaluates each file but never runs the job
queue, so no promise reaction or async function continuation ever
executes. That is why every async/Promise compat-table test fails for
this engine (ES2017 async functions, ES2018 Promise.prototype.finally
and async iterators, ES2021 Promise.any), while the qjs shell of C
QuickJS, which runs its event loop, passes them.

This change drains the queue with VM.ExecutePendingJobs after each
evaluation, in file mode and in the REPL, as the qjs shell does. With
it, these print OK where they printed nothing before:

compat-table/es2017/async.await.js
compat-table/es2018/Promise.prototype.finally.js
compat-table/es2018/async-iterators.for-await-of.js
compat-table/es2021/Promise.any.fulfillment.js

Separately, could the benchmarks for modernc-quickjs be re-run at some
point? The published numbers come from e0b6329 (v0.17.1-111,
2026-03-03). On the V8 suite v7, the core of Octane, the engine is now
1.8x (amd64) to 2.0x (arm64) faster than that revision:

V8 v7 score       e0b6329   master   goja master
amd64 (3900X)       218       398        242
arm64 (M1)          318       642        489

Run on my amd64 machine, e0b6329 lands within 5% of the published amd64
numbers (Richards 132 vs 142, Splay 619 vs 682), so the comparison
should carry over to your runners.

Disclosure: I maintain modernc.org/quickjs.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant