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

can deno compile into bytecode? #8820

Closed
liesauer opened this issue Dec 18, 2020 · 17 comments
Closed

can deno compile into bytecode? #8820

liesauer opened this issue Dec 18, 2020 · 17 comments
Labels
cli related to cli/ dir suggestion suggestions for new features (yet to be agreed)

Comments

@liesauer
Copy link

i just found that deno compile just embeds all the source codes at the end of the executable, and it is very easy to extract them. so, can deno compile the source codes into bytecodes(or any future plans) so it can protect the code.

@chenguzhen87
Copy link
Contributor

I'm curious. How do you know all the source codes at the end of the executable

@caspervonb
Copy link
Contributor

I'm curious. How do you know all the source codes at the end of the executable

Can be seen in any hex editor or even objdump.

@liesauer
Copy link
Author

I'm curious. How do you know all the source codes at the end of the executable

Can be seen in any hex editor or even objdump.

u are right

@kitsonk
Copy link
Contributor

kitsonk commented Dec 18, 2020

It is a complicated process, as we would have to generate a custom snapshot, which is also architecture specific. It is being considered, but I wouldn't expect it any time soon.

@kitsonk kitsonk added cli related to cli/ dir suggestion suggestions for new features (yet to be agreed) labels Dec 18, 2020
@chenguzhen87
Copy link
Contributor

I was doing a comparison between Deno compile and go build products, and found that the .exe file generated by Deno is 31.4mb, and go is 2.02mb, tests article.
Can Deno be less

@RDambrosio016
Copy link

That is an unfair comparison because go compiles to machine code plus some runtime and gc stuff, javascript cannot be compiled to machine code, therefore deno has to ship v8 and its runtime in each executable.

@lucacasonato
Copy link
Member

Deno compiled executables will get smaller in the future though. We estimate 15-20 MB for a hello world.

@liesauer
Copy link
Author

supporting both framework(or runtime)-dependent deployment mode and standalone deployment mode would be nice, just like .NET Core does.

@wwderw
Copy link

wwderw commented Jan 31, 2021

It is a complicated process, as we would have to generate a custom snapshot, which is also architecture specific. It is being considered, but I wouldn't expect it any time soon.

It would be nice to have something like how NW.js has. The main thing that I had always liked about it over Electron, only downside is that it is much bigger for final product size then even electron. Looking at 300+ MB for deployment with NW.js and about 90MBs for electron deployment. Had to make sure making some pretty big apps to justify that harddrive size consumption. RAM usage was about the same.

@ghost
Copy link

ghost commented Feb 28, 2021

Related to #3335

@nettybun
Copy link

Related to #9243 about Deno's size

@lucacasonato
Copy link
Member

There are no plans to compile to raw instructions in deno compile - that would be a monumental feat for us. Consider looking into https://porffor.dev/ instead.

We will continue to work on reducing deno compile binary size, but this issue is not actionable for that.

@felipecrs
Copy link

Out of curiosity, Bun 1.1.30 has shipped compilation to bytecode which allegedly improves start time by 2x.

Improvements of such magnitude would be a huge deal for certain projects, even at the cost of bigger binaries.

FWIW Electron Vite also allows for bytecode compilation, for V8-based runtimes.

@0f-0b
Copy link
Contributor

0f-0b commented Oct 14, 2024

What about compiling to code caches? Cached code can be executed without the corresponding source code if all functions are eagerly compiled and the checksum is zeroed out.

@petamoriken
Copy link
Contributor

I'm looking forward to waiting for the Binary AST proposal.

@SerJaimeLannister
Copy link

Out of curiosity, Bun 1.1.30 has shipped compilation to bytecode which allegedly improves start time by 2x.

Improvements of such magnitude would be a huge deal for certain projects, even at the cost of bigger binaries.

FWIW Electron Vite also allows for bytecode compilation, for V8-based runtimes.

I was also thinking of the same thing!

I do hope that deno could also add bytecode support

@bartlomieju
Copy link
Member

FYI this should be available in Deno v2.1.0 - PR to follow #26528

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli related to cli/ dir suggestion suggestions for new features (yet to be agreed)
Projects
None yet
Development

No branches or pull requests