-
Notifications
You must be signed in to change notification settings - Fork 1.1k
doc: Recommend clang-cl when building on Windows #1681
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
base: master
Are you sure you want to change the base?
Conversation
Are benchmarks all that should be considered? From what I can see there's there's only a single It would also be interesting to elaborate on why the performance of MSVC is so much worse than Clang. |
Several factors may contribute to the performance gap:
However, I haven't compared the generated assembly code. |
Another factor is that clang-cl uses native 128-bit integer types, whereas MSVC relies on |
Although clang-cl supports inline assembly, as indicated by the configure summary:
I observed no benchmark difference between |
Fair enough. More clang-cl CI tasks have been added. |
.github/workflows/ci.yml
Outdated
- job_name: 'x64 (MSVC): Windows (clang-cl, shared)' | ||
cmake_options: '-T ClangCL -DBUILD_SHARED_LIBS=ON' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming: Shouldn't this be: x64 (clang-cl): Windows (VS 2022, shared)
then? It's not a MSVC build.
(We could rework the naming of the jobs in general, it's not very consistent, and it's also not very helpful because the long names are truncated too early in the sidebar on https://github.com/bitcoin-core/secp256k1/pull/1681/checks, but that's a separate issue.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Renamed.
I doubt that MSVC was ever supposed to be a recommendation. (I wouldn't recommend MSVC to anyone...) It's just an example, and it's the default compiler in VS as far as I understand.
But sure, I can't hurt to test more in clang-cl. Though we have a good clang coverage already, just not on Windows. But since we hardly use the C stdlib or syscalls, that's still a good coverage. |
a5d4cd3
to
9243e21
Compare
README.md
Outdated
Using clang-cl is recommended, as it tends to produce better-performing binaries compared to MSVC. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using clang-cl is recommended, as it tends to produce better-performing binaries compared to MSVC. | |
Using clang-cl is recommended. |
There are more reasons to prefer clang, e.g., the (forgotten) #1164 or just the fact its output more testing (though mostly on Linux). But it's difficult to explain in one or two sentences, and I think it's ok not to explain it here.
edit: I also suggest dropping the empty line after this sentence, but somehow the GitHub suggestion feature doesn't understand this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Updated, including dropping the empty line.
Concept ACK |
There are several reasons to prefer clang-cl over MSVC, such as improved security and performance.
Below are the benchmark results for the master branch @ 201b2b8:
On my local machine, the "Release" build configuration: