this post was submitted on 25 Apr 2025
11 points (100.0% liked)

Linux

53508 readers
1703 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

A thorough examination of the performance effects of using undefined behaviour in compiler optimizations.

Method:

  1. Modifying clang to not use UB where this is possible
  2. Run a large suite of benchmarks on different architectures, compare results for modified and unmodified clang
  3. Do statistics on the results
  4. Examine performance deviations
  5. Discuss factors which could bias results.

Very good science!

Result in short:

Only on ARM and if no link-time optimization is used, a systematic small positive performance effect can be seen. For Intel and AMD CPUs, there are no systematic improvements.

Average effects are typically below 2%, which is the typical effect of system and measurement noise. Often, effects are even negative. In some cases, benchmarks show large differences, and many of these can be fixed by simple modifications to the compiler or program.

top 2 comments
sorted by: hot top controversial new old
[–] bla_bla_bla@feddit.org 2 points 3 hours ago (1 children)

C++ is probably the ugliest designed mainstream language out there

[–] mina86@lemmy.wtf 1 points 1 hour ago

It is a product of its time. If the same research was made 30 years ago, I bet there would be a stark difference to results today. LTO wasn’t as feasible. Compilers were less capable of removing redundant checks. Branch prediction in x86 processors was still a hot new thing. And on top of it all, there was less knowledge about language development.