pmq20 / ruby-packer

Packing your Ruby application into a single executable.
MIT License
1.56k stars 99 forks source link

Ahead of time or just packaging? #4

Closed emilebosch closed 7 years ago

emilebosch commented 7 years ago

Ahead of time implies you compile it to LLVM/Instruction set? Would you care to elaborate?

anaisbetts commented 7 years ago

While this project is cool, I suspect its use of the term "AOT compilation" is a little inaccurate. It's more like https://github.com/zeit/pkg for Ruby

siuying commented 7 years ago

This project seems more comparable to Traveling Ruby

pmq20 commented 7 years ago

@paulcbetts Exactly. Currently it is just packaging, but when combined with work of @ko1 we could achieve real compiling in order to boost start-up speed and also protect intellectual properties.

I talked to @ko1 last year after his presentation about AOT compiling for Ruby at RailsConf, and it seems like we were missing a piece of the puzzle at that time, which is to preserve a virtual file system after compiling, in order to accommodate __FILE__ and require calls. I achieved it now with the help of libsquash. So now in runtime every path that begins with /__enclose_io_memfs__/ got redirected to the memory, and so are your project files.

stereobooster commented 7 years ago

So what next step? You will some existing solution, like rubyomr or there exists prototype of AOT from @ko1 ?

pmq20 commented 7 years ago

@stereobooster Rubyomr is JIT instead of AOT. There is indeed existing prototype from work of @ko1 : https://github.com/ko1/yomikomu I have to take some time to integrate it.

tmm1 commented 7 years ago

See also https://github.com/Shopify/bootsnap/blob/master/README.md

stereobooster commented 7 years ago

But bootsnap simply precompile code to bytecode, e.g. we reduce parse time on load/reload, nothing else. Am I right? Does this mean that AOT will give only speed up on parse time and nothing else?

pmq20 commented 7 years ago

@stereobooster Also intellectual property protection, byte-code is harder to reverse-engineer than Ruby-code. In addition to,

image

pmq20 commented 7 years ago

@tmm1 Thanks for recommending bootsnap! Let me look into it.

andy-twosticks commented 7 years ago

FWIW I think the packaging thing on its own is worth while doing even if you never get to the point of having performance improvement.

I know there are other things out there that do that, but that's fine. This is important and IMO it's not a solved problem yet.