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

Move on clang LLVM #902

Closed
PeterDaveHello opened this issue Nov 9, 2015 · 7 comments
Closed

Move on clang LLVM #902

PeterDaveHello opened this issue Nov 9, 2015 · 7 comments
Labels
feature requests I want a new feature in nvm! installing node Issues with installing node/io.js versions.

Comments

@PeterDaveHello
Copy link
Collaborator

Tested on FreeBSD 10.1 64bit with nodejs v0.12.7

$ uname -a

FreeBSD vm2 10.1-RELEASE-p19 FreeBSD 10.1-RELEASE-p19 #0: Sat Aug 22 03:55:09 UTC 2015 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64

$ c++ --version

FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
Target: x86_64-unknown-freebsd10.1
Thread model: posix

$ g++ --version

g++ (FreeBSD Ports Collection) 4.8.5
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compilation time spent by clang LLVM:

real 1m49.474s
user 14m51.253s
sys 2m0.750s

Compilation time spent by clang GCC:

real 2m23.481s
user 20m24.823s
sys 2m54.503s

@PeterDaveHello
Copy link
Collaborator Author

@ljharb What do you think about the checklist?
I'm using Ubuntu, Debian and FreeBSD as my main workstations.

@ljharb
Copy link
Member

ljharb commented Nov 11, 2015

I think certainly doing it for FreeBSD is good - I'm very nervous about changing how everything is compiled - but the speedup is very tempting. We'll also need to test on travis-ci as well as Mac OS.

@PeterDaveHello
Copy link
Collaborator Author

Okay I removed the checklist, but we need to solve the compilation on FreeBSD first, in fact the latest nodejs on FreeBSD doesn't need any patches, what about support compile from merged nodejs aka version greater than 1.0 from now?

@ljharb
Copy link
Member

ljharb commented Nov 13, 2015

That'd be a fine start, and there's existing helpers that should allow you to do that :-)

@PeterDaveHello
Copy link
Collaborator Author

Okay let's give it a try.

@PeterDaveHello
Copy link
Collaborator Author

Manual compile test:

clang llvm:

~/node-v4.2.2 $ clang++ --version
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
Target: x86_64-unknown-freebsd10.1
Thread model: posix
~/node-v4.2.2 $ time make CXX=clang++ -j 15
.
.
.
real    2m27.425s
user    26m51.125s
sys     2m27.803s

gcc:

~/node-v4.2.2 $ g++ --version
g++ (FreeBSD Ports Collection) 4.8.5
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
~/node-v4.2.2 $ time make CXX=g++ -j 15
.
.
.
real    3m12.031s
user    35m14.671s
sys     4m5.747s

9 min 23 sec diff in user space, about 30% time spent

@PeterDaveHello
Copy link
Collaborator Author

Start to work on this again.

Now test nodejs v7.1.0 on Debian 8.6 amd64, with 25 threads.

$ g++ --version
g++ (Debian 4.9.2-10) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ time make CXX=g++ -j 25
.
.
.
real    6m59.985s
user    133m10.544s
sys     5m43.584s
$ clang++ --version
Debian clang version 3.5.0-10 (tags/RELEASE_350/final) (based on LLVM 3.5.0)
Target: x86_64-pc-linux-gnu
Thread model: posix
$ time make CXX=clang++ -j 25
.
.
.
real    4m59.905s
user    96m25.876s
sys     3m21.440s

Base on this result, we may try to use clang by detecting if clang exists, it'll save our time on the compilation.

@ljharb ljharb added feature requests I want a new feature in nvm! installing node Issues with installing node/io.js versions. labels Nov 17, 2016
ljharb pushed a commit to PeterDaveHello/nvm that referenced this issue Nov 17, 2016
ljharb added a commit that referenced this issue Nov 17, 2016
[New] `nvm install -s`: Use clang as C/C++ compiler if detected

Fixes #902
edwmurph pushed a commit to edwmurph/nvm that referenced this issue Apr 9, 2018
edwmurph pushed a commit to edwmurph/nvm that referenced this issue Apr 9, 2018
[New] `nvm install -s`: Use clang as C/C++ compiler if detected

Fixes nvm-sh#902
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature requests I want a new feature in nvm! installing node Issues with installing node/io.js versions.
Projects
None yet
Development

No branches or pull requests

2 participants