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

Precompiled binaries #96

Open
mischnic opened this issue Apr 27, 2018 · 8 comments
Open

Precompiled binaries #96

mischnic opened this issue Apr 27, 2018 · 8 comments
Milestone

Comments

@mischnic
Copy link
Collaborator

... would shorten install time drastically.

@parro-it
Copy link
Owner

I think I can reuse part of the configuration I wrote to compile libui binaries on travis & appveyor.

@mischnic
Copy link
Collaborator Author

mischnic commented Apr 29, 2018

How would different node versions get handled?

@parro-it
Copy link
Owner

How would different node versions get handled?

I'll install (or hopefully it's already installed) nvm and I'll use that to switch node version and build binaries on every version of the node API we support.

I think there are some tools that can help in the process...

New node versions will be included as they are published, we'll have to trigger the CI build doing some commits...

@mischnic
Copy link
Collaborator Author

N-API (pronounced N as in the letter, followed by API) is an API for building native Addons. It is independent from the underlying JavaScript runtime (ex V8) and is maintained as part of Node.js itself. This API will be Application Binary Interface (ABI) stable across versions of Node.js. It is intended to insulate Addons from changes in the underlying JavaScript engine and allow modules compiled for one version to run on later versions of Node.js without recompilation. (https://nodejs.org/api/n-api.html)

Not sure if nbind allows that or how N-API is supported by older node versions.

@parro-it
Copy link
Owner

Yes, that would be awesome because it would solve the node version problem, but nbind unfortunately does not support it. We can try to ask for the feature, but I think it would be really a big job.

Also, I started months ago to do some experiments building a tool similar to nbind but that uses NAPI instead of NAN. But the tool is very rough ATM. If you want to give it a look, I can add you to the private repo where I'm keeping it.

This tool could probably be simplified by only implement features needed by libui-node.

Another advantage (but that will add even more work to do) is that using N-API allows to bind directly to C functions, so we can avoid the C++ wrappers at all, and implement a public API directly in JavaScript.

@mischnic
Copy link
Collaborator Author

mischnic commented May 3, 2018

Related: parro-it/libui-download#3

@parro-it
Copy link
Owner

parro-it commented May 3, 2018

I start to experiment with a N-API version of the library here: https://github.com/parro-it/libui-napi

There, I setup prebuilt binaries using Travis & AppVeyor. You could see a first release on the repo.
If you try to install the package, the binaries get download and they should not be compiled every time. The same binaries works on Node 9 & 10, and I tested them only on macOS High Sierra.

There is still a problem on CI: when you push a new tag, the publish phase is triggered, and if the build for other commits trigger to early, it try to download partially built binaries and fails.

I'm also rewriting documentation using same tools as proton-native, and add tests using screenshot-tester.

The idea is to continue the experiment implementing windows, multiline entries and boxes,
and then compare this version with a stripped down version of libui-node that only implement the same widgets. I'll compare them based on:

  1. compilation speed
  2. binaries size
  3. memory consumption
  4. easy of development

Until now, I already find some benefits of using N-API

  • Compilation is really fast.
  • We have full control on memory management.

@mischnic
Copy link
Collaborator Author

mischnic commented May 3, 2018

The same binaries works on Node 9 & 10, and I tested them only on macOS High Sierra.

Also node 8 & Sierra!

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

2 participants