I have just noticed that Espressif provides support for clang since some time.
What are your experiences with this? Does one lead to better code over another?
clang vs. gcc
-
MicroController
- Posts: 2661
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: clang vs. gcc
Tried it a few times, never got clang to work on Windows, gave up.
My general impression is that clang may optimize some constructs a little better than gcc, saving one instruction here or there, but I think you'd be hard-pressed to find a case where it makes a measurable difference.
(If 1 or 2 instructions more or less in a section of code do make a significant difference in a certain case, I'd argue that that code shouldn't be left to chance by hoping for the compiler to choose the 'right' optimization every time.)
My general impression is that clang may optimize some constructs a little better than gcc, saving one instruction here or there, but I think you'd be hard-pressed to find a case where it makes a measurable difference.
(If 1 or 2 instructions more or less in a section of code do make a significant difference in a certain case, I'd argue that that code shouldn't be left to chance by hoping for the compiler to choose the 'right' optimization every time.)
Re: clang vs. gcc
FWIW, I think clang (or llvm) support in general is mostly done to get Rust to work. As far as I understand, gcc does not support Rust (yet).
-
DrMickeyLauer
- Posts: 209
- Joined: Sun May 22, 2022 2:42 pm
Who is online
Users browsing this forum: Amazon [Bot], Baidu [Spider], Google [Bot], PetalBot and 4 guests
