Performance Clang

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Performance Clang

Heiko
Hello Misc,

I'm using current on amd64 (Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz,
3411.91 MHz)

I noticed that with clang it needs 109 minutes for "make build" and
before with gcc 32 minutes.

Is this a normal behavior?

Best,
Heiko

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Performance Clang

Theo de Raadt-2
> I'm using current on amd64 (Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz,
> 3411.91 MHz)
>
> I noticed that with clang it needs 109 minutes for "make build" and
> before with gcc 32 minutes.
>
> Is this a normal behavior?

For sure.  Why the surprise?

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Performance Clang

Michael McConville-3
In reply to this post by Heiko
Heiko wrote:
> I noticed that with clang it needs 109 minutes for "make build" and
> before with gcc 32 minutes.
>
> Is this a normal behavior?

An email from Miod that gets cited often:

https://marc.info/?l=openbsd-misc&m=137530560232232&w=2

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Performance Clang

Heiko
In reply to this post by Theo de Raadt-2
I was not aware that the difference is 340%.

So I guess the main advantage is the license?
Or is clang technically (binaries, debug) better?

Am 20.04.17 um 03:42 schrieb Theo de Raadt:

>> I'm using current on amd64 (Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz,
>> 3411.91 MHz)
>>
>> I noticed that with clang it needs 109 minutes for "make build" and
>> before with gcc 32 minutes.
>>
>> Is this a normal behavior?
>
> For sure.  Why the surprise?
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Performance Clang

Theo de Raadt-2
> I was not aware that the difference is 340%.
>
> So I guess the main advantage is the license?

No.

> Or is clang technically (binaries, debug) better?

No.

Basically, this cannot be oversimplified by 1 line questions followed
by 1 line answers.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Performance Clang

Heiko
In reply to this post by Michael McConville-3
Thank you.

Am 20.04.17 um 03:55 schrieb Michael McConville:
> An email from Miod that gets cited often:
>
> https://marc.info/?l=openbsd-misc&m=137530560232232&w=2

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Performance Clang

Karel Gardas
In reply to this post by Heiko
On Thu, Apr 20, 2017 at 1:43 AM, Heiko <[hidden email]> wrote:
> Hello Misc,
>
> I'm using current on amd64 (Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz,
> 3411.91 MHz)
>
> I noticed that with clang it needs 109 minutes for "make build" and
> before with gcc 32 minutes.
>
> Is this a normal behavior?

This is entirely unfair comparison. I've just make build yesterday
tree to verify your claims and honestly what I've seen is:

1) system/core is still built with cc which means gcc 4.2.1
2) added compiler_rt is built with clang
3) added libc++ is built with clang++
4) added LLVM needed by clang is build with clang++
5) added clang is build with clang++

so what you compare is:
- OpenBSD system/core build with GCC 4.2.1 (old system)
with
- OpenBSD system/core build with GCC 4.2.1 and Clang runtime libraries
and LLVM code and Clang itself built with Clang (new system)

IMHO very unfair comparison and you should really wait till OpenBSD
system/core is build with Clang and GCC 4.2.1 is removed from the
build process. Well, do not hold your breath for that to be comparable
in speed. LLVM/Clang is C++ beast and so it takes some time to compile
but at least the comparison would be more fair...

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Performance Clang

Christian Weisgerber
In reply to this post by Heiko
On 2017-04-19, Heiko <[hidden email]> wrote:

> I'm using current on amd64 (Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz,
> 3411.91 MHz)
>
> I noticed that with clang it needs 109 minutes for "make build" and
> before with gcc 32 minutes.

Not sure what you mean by "performance" in the subject.  We're not
building anything with clang yet, apart from clang itself.  We have
simply added clang.  The rest of the build is identical.

And yes, clang is a big C++ program and C++ code compiles s l o w l y.

> Is this a normal behavior?

The exact numbers are a bit odd, but generally speaking, yes, adding
clang has substantially increased the build time.  I see about a
doubling on Xeon E3-12xx-based machines for make -j4 build.

--
Christian "naddy" Weisgerber                          [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Performance Clang

Christian Weisgerber
In reply to this post by Heiko
On 2017-04-20, Heiko <[hidden email]> wrote:

> So I guess the main advantage is the license?
> Or is clang technically (binaries, debug) better?

OpenBSD does not live in a bubble.  If it did, we could still be
using gcc 2.95.  But it turns out people, including OpenBSD developers,
want to run third-party software.  And the ecosystem requires a
modern compiler.

You know what an amd64 package bulk build looks like?  First, we
use our system compiler to build gcc 4.9.  Then we use gcc 4.9 to
build clang.  And then we use clang to build interesting stuff,
like web browsers.  Stages like a moonshot rocket.

If we want to continue to be able to run third-party software, we
need a newer compiler.

--
Christian "naddy" Weisgerber                          [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Performance Clang

Heiko
In reply to this post by Karel Gardas
Please dont get me wrong. I dont want to start any compiler wars.

I only was worried about the compile time.

Am 20.04.17 um 20:50 schrieb Karel Gardas:
> IMHO very unfair comparison and you should really wait till OpenBSD
> system/core is build with Clang and GCC 4.2.1 is removed from the
> build process. Well, do not hold your breath for that to be comparable
> in speed. LLVM/Clang is C++ beast and so it takes some time to compile
> but at least the comparison would be more fair...

Sure, we shall see.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Performance Clang

Heiko
In reply to this post by Christian Weisgerber
Thank you for the info. So you expect a lower time in future.

Am 20.04.17 um 21:31 schrieb Christian Weisgerber:
> The exact numbers are a bit odd, but generally speaking, yes, adding
> clang has substantially increased the build time.  I see about a
> doubling on Xeon E3-12xx-based machines for make -j4 build.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Performance Clang

Andreas Kusalananda Kähäri
In reply to this post by Christian Weisgerber
On Thu, Apr 20, 2017 at 07:31:47PM +0000, Christian Weisgerber wrote:

> On 2017-04-19, Heiko <[hidden email]> wrote:
>
> > I'm using current on amd64 (Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz,
> > 3411.91 MHz)
> >
> > I noticed that with clang it needs 109 minutes for "make build" and
> > before with gcc 32 minutes.
>
> Not sure what you mean by "performance" in the subject.  We're not
> building anything with clang yet, apart from clang itself.  We have
> simply added clang.  The rest of the build is identical.
>
> And yes, clang is a big C++ program and C++ code compiles s l o w l y.
>
> > Is this a normal behavior?
>
> The exact numbers are a bit odd, but generally speaking, yes, adding
> clang has substantially increased the build time.  I see about a
> doubling on Xeon E3-12xx-based machines for make -j4 build.


I'm happy as long as building the complete base system takes less than a
day.  I'm more concerned with the compiler generating good code, to be
honest.

Cheers,
Kusalananda

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Performance Clang

Marc Espie-2
In reply to this post by Heiko
On Thu, Apr 20, 2017 at 11:14:24PM +0200, Heiko wrote:
> Thank you for the info. So you expect a lower time in future.

If we eventually remove gcc 4.2.1, yes, the time will go down from
clang+gcc to clang without gcc :)

Apparently, it seems that lld might be better behaved than binutils ld
in *some* respects like speed and memory consumption in *some* cases...

we'll see.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Performance Clang

Marc Espie-2
In reply to this post by Christian Weisgerber
On Thu, Apr 20, 2017 at 07:46:00PM +0000, Christian Weisgerber wrote:

> On 2017-04-20, Heiko <[hidden email]> wrote:
>
> > So I guess the main advantage is the license?
> > Or is clang technically (binaries, debug) better?
>
> OpenBSD does not live in a bubble.  If it did, we could still be
> using gcc 2.95.  But it turns out people, including OpenBSD developers,
> want to run third-party software.  And the ecosystem requires a
> modern compiler.
>
> You know what an amd64 package bulk build looks like?  First, we
> use our system compiler to build gcc 4.9.  Then we use gcc 4.9 to
> build clang.  And then we use clang to build interesting stuff,
> like web browsers.  Stages like a moonshot rocket.
>
> If we want to continue to be able to run third-party software, we
> need a newer compiler.

The reason for having both compilers in base is that the "transition"
is not easy.

There is a lot of stuff in the ports tree that's rather old and doesn't
compile with a newer compiler (pre-ANSI C for instance, GNU-C89 inlines,
lots of stuff that thinks C++ templates are macros, thus is happy with
totally out-of-order definitions... and so on and so forth)

Some adventurous souls are currently figuring out how to prepare stuff for
clang/clang++, while not breaking it for base gcc.

(some other souls run arm64, so they don't really have a choice in that
matter).

This is by no means finished. clang is a challenge, lld is another, arm64 is
a third one.

But there is some modicum of progress...

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Performance Clang

Damian McGuckin
In reply to this post by Marc Espie-2
On Tue, 25 Apr 2017, Marc Espie wrote:

> On Thu, Apr 20, 2017 at 11:14:24PM +0200, Heiko wrote:
>> Thank you for the info. So you expect a lower time in future.
>
> If we eventually remove gcc 4.2.1, yes, the time will go down from
> clang+gcc to clang without gcc :)
>
> Apparently, it seems that lld might be better behaved than binutils ld
> in *some* respects like speed and memory consumption in *some* cases...
>
> we'll see.

Doesn't Clang have superior (and integrated) static analysis tools?

Regards - Damian

Pacific Engineering Systems International, 277-279 Broadway, Glebe NSW 2037
Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | unsolicited email not wanted here
Views & opinions here are mine and not those of any past or present employer

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Performance Clang

Michael McConville-3
Damian McGuckin wrote:
> On Tue, 25 Apr 2017, Marc Espie wrote:
> > Apparently, it seems that lld might be better behaved than binutils
> > ld in *some* respects like speed and memory consumption in *some*
> > cases...
> >
> > we'll see.
>
> Doesn't Clang have superior (and integrated) static analysis tools?

Yes, but that's orthogonal to the speed and correctness of compilation.

Loading...