LLVM has become a sweathog, time to start over

submited by
Style Pass
2021-05-27 19:30:05

LLVM is the most popular back-end for compilers now. It is used all over the place, however it has become a giant sweathog of a program and is in the millions of lines of code. There is no excuse for the massive growth; the should have used a plug-in architecture like Adobe Photoshop or Audigy, with a lean core, and then optional modules to do certain tasks. Some people were trying to compile it from source and it took hours. The Intel and ARM instruction sets are pretty simple, and since one typically does not know which processor you are on, there isn’t much point in using some instruction that some percentage of people won’t have, so why bother trying to use the insane instructions that were added by Intel for the main purpose of slowing down the chip cloners in China. If you consult the processor specs, such as Ryzen data sheet you will see that the Ryzen 5 3600 CPU only has a mere 32MB of Cache, and if you have 32 GB of RAM as many people do, that means only 1 out of a 1000 bytes of RAM is in cache, so if your program is jumping around memory following sparsely arranged data structures, the poor old CPU is going to be stalled. This is my point, that LLVM doesn't fix how data structures are arranged in RAM and thus is fighting the wrong battle.

All the instruction optimization effort is for naught if you haven't got a sensible runtime and memory allocation strategy. One of the old tricks i have used myself many times to make a program super fast is to pre-allocated big arrays of data structures that are identical in size, and by focusing the eye of the CPU on a smaller area of RAM it keeps the CPU happy and runs fast. If you never allocate or deallocate memory things stay put, and the CPU is much happier.

Leave a Comment