Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose the bytecode in cli #777

Open
gengjiawen opened this issue Dec 29, 2024 · 11 comments
Open

expose the bytecode in cli #777

gengjiawen opened this issue Dec 29, 2024 · 11 comments

Comments

@gengjiawen
Copy link

This will make debug and performance more easily

v8
CleanShot 2024-12-29 at 17 32 00@2x

MonkeyLang
CleanShot 2024-12-29 at 17 33 04@2x

@bnoordhuis
Copy link
Contributor

You already can, kind of - it's the -D1 flag to qjs (JS_SetDumpFlags in quickjs.h)

@gengjiawen
Copy link
Author

You already can, kind of - it's the -D1 flag to qjs (JS_SetDumpFlags in quickjs.h)

qjs -D1 t2.js no output on my side (version: ng 0.8.0). I am directly use the release binary, should I build my own or something I miss ?

@bnoordhuis
Copy link
Contributor

You'll need a debug build (no -DNDEBUG)

@gengjiawen
Copy link
Author

Any chance this is moves into production build by default. Consider it's under a flag, won't drag down perf in normal mode.

@saghul
Copy link
Contributor

saghul commented Dec 30, 2024

Some of the debug flags may have an impact if enabled in release builds.

@bnoordhuis
Copy link
Contributor

Any chance this is moves into production build by default. Consider it's under a flag, won't drag down perf in normal mode.

Probably not because it embiggens the library by quite a bit. One of quickjs's design goals is being able to run in constrained environments so we're mindful of size.

@chqrlie
Copy link
Collaborator

chqrlie commented Dec 30, 2024

Enabling all the trace/dump facilities does cause a slow down even if the flags are not enabled via a command line option or a call to JS_SetDumpFlags(). PR #770 is underway to control these features and expose the flags, but we should probably investigate an intermediary approach where selected features are compiled that do not affect performance but give the developper access to the byte code: the ability to output the byte code or more generally give enough access for debugging should be available separately.

@gengjiawen
Copy link
Author

Probably not because it embiggens the library by quite a bit. One of quickjs's design goals is being able to run in constrained environments so we're mindful of size.

In real cases in embedder we can always turn it off. But we need perf insight during development, which is my real case.

@saghul
Copy link
Contributor

saghul commented Jan 1, 2025

Can't you use a Debug build for that?

@gengjiawen
Copy link
Author

Can't you use a Debug build for that?

That's what I do for now. But I want this make it to the default build. Sometimes I want to do the diff with latest qjs binary in release page.

@saghul
Copy link
Contributor

saghul commented Jan 2, 2025

We would need to separate the bytecode dumping logic from the other dump flags I guess...

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

No branches or pull requests

4 participants