Hacker News new | ask | show | jobs
by microtonal 5555 days ago
Could someone elaborate why one would use pcc over the also liberally licensed clang/LLVM, except for ancient architectures on which LLVM doesn't run or is too slow?
1 comments

The original motivation (from back in 2007) was threefold:

(1) BSD licensed, which was felt to be preferable to GCC (ie. GPL) for BSD developers.

(2) It's supposed to compile things 5-10 times faster than GCC.

(3) Very portable to new architectures; obviously a good thing for NetBSD which is ported to just about everything.

LLVM doesn't figure into this; perhaps it was unknown or not very capable back in 2007?

Source: http://marc.info/?l=netbsd-tech-toolchain&m=118961767521...

Although LLVM existed and was fairly well known, it was a middle/backend-only project until mid-2007 or so, and used gcc as the language frontend. Clang's first source release wasn't until July 2007, and I don't think it got much traction until 2008, and a 1.0 release in late 2009. So it seems plausible that a September 2007 discussion wouldn't have it on the radar.
Also in (3), very portable to old architectures. PCC is written in C, where LLVM/Clang is C++. This makes one less hurdle to bootstrapping a new compiler on some archs.
From experience in porting an OS, common porting scaffolding can include a cross compiler and a cross linker, and replacing an assembler with a compiler for compiling the assembly code for the new target box.

Getting a native build and a native C++ and a native assembler re-hosted can then proceed secondary to getting the basic OS pieces booted and rolling.

With regard to 2, I don't care so much about compile speed (within reason) as I do about the speed of the produced binary. How fast is the output?
Depends entirely on what particular optimizations apply to your code. Overall, pcc is probably within 10% for most code, but you'll also find examples where gcc or llvm is 10x faster. It all depends.
If your maintaining code on a VAX, you care a tad bit about compile speed.