Date: Fri, 12 Nov 2021 01:09:53 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 259789] clang 9 and later performance regression using pointers to traverse arrays Message-ID: <bug-259789-227@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D259789 Bug ID: 259789 Summary: clang 9 and later performance regression using pointers to traverse arrays Product: Base System Version: Unspecified Hardware: amd64 OS: Any Status: New Severity: Affects Some People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: jwb@freebsd.org This may be an upstream issue, but I'm starting here in hopes that someone would know for sure. I have not yet tried to reproduce this on other platfo= rms. 1. The clang man page states that -O is equivalent to -O2, which is clearly= not the case for clang11 per the benchmark data below. 2. I wrote a very simple benchmark suite using selection sort to compare the performance of various compilers and interpreters. There are subscript and pointer versions for C. I just noticed that the pointer implementation tak= es more than twice as long as the subscript implementations using clang90 or later. On amd64 with a modern compiler, I would expect very little differe= nce, maybe a slight advantage to the pointer implementation, which is what I see with clang80 and gcc10. To reproduce: git clone https://github.com/outpaddling/Lang-speed cd Lang-speed ./clang-check clang version 8.0.1 (tags/RELEASE_801/final)=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20 Target: x86_64-portbld-freebsd13.0=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 Thread model: posix=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 InstalledDir: /usr/local/llvm80/bin=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20 -O=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 Subscripts: 2.27 real 2.27 user 0.00 sys=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 Pointers: 2.05 real 2.05 user 0.00 sys=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 -O2=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20 Subscripts: 2.10 real 2.10 user 0.00 sys=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 Pointers: 2.02 real 2.02 user 0.00 sys=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 clang version 9.0.1=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 Target: x86_64-portbld-freebsd13.0=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 Thread model: posix=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 InstalledDir: /usr/local/llvm90/bin=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20 -O=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 Subscripts: 2.09 real 2.09 user 0.00 sys=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 Pointers: 4.67 real 4.67 user 0.00 sys=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 -O2=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20 Subscripts: 2.05 real 2.05 user 0.00 sys=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 Pointers: 4.62 real 4.62 user 0.00 sys=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 FreeBSD clang version 11.0.1 (git@github.com:llvm/llvm-project.git llvmorg-11.0.1-0-g43ff75f2c3fe)=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20 Target: x86_64-unknown-freebsd13.0=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 Thread model: posix=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 InstalledDir: /usr/bin=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 -O=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 Subscripts: 4.62 real 4.62 user 0.00 sys=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 Pointers: 4.67 real 4.67 user 0.00 sys=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 -O2=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20 Subscripts: 2.04 real 2.04 user 0.00 sys=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 Pointers: 4.61 real 4.61 user 0.00 sys --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-259789-227>