[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Improving EQ
From: |
Pip Cet |
Subject: |
Re: Improving EQ |
Date: |
Thu, 12 Dec 2024 17:05:32 +0000 |
"Andrea Corallo" <acorallo@gnu.org> writes:
> Óscar Fuentes <ofv@wanadoo.es> writes:
>> I've seen too many cases where *removing* instructions (mind you,
>> literally removing, not changing!) made the code significantly slower.
Yes, there are many ways in which that can happen. Removing prefetches
or branch hints is the most obvious example, but I don't claim to know
all the ways, and ultimately if an expected performance improvement does
not materialize we might have to decide this one on code size reasons
alone (of course, if performance is drastically worse, we shouldn't
apply the patch).
>> Modern CPUs are insanely complex and combined with compilers make
>> intuition-based predictions even more futile.
The compiler isn't the issue here, since I checked the assembly code
that was generated. Totally agree about CPUs. For example, moving code
out of line will change many conditional branch locations to a single
one (the one in the out-of-line function), which may help or hurt branch
prediction, and that's just one of many ways in which inline functions
often lose. So we should also benchmark whether this might be one of
those cases, in which case we'd want to move all of EQ to a non-inlined
function...
> That's why the patch needs to be benchmarked anyway.
Absolute agreement there. I tried some initial benchmarks and it's lost
in the noise, but that was while running on battery on a laptop, and I
need to test on a machine with a proper fixed clock rate.
>> But reading your message makes me wonder if EQ and some other "simple"
>> fundamental functions are not lowered by nativecomp? If not, maybe
>> that's a significant opportunity for improvement.
>
> Nativecomp only compiles eq for Lisp code, the one discussed here is the
> eq used in C (and bytecode).
>
> BTW ATM nativecomp generates code with the same layout of the eq we had
> in C till my last change of few weeks ago. When eq will be stable in C
> I guess I'll replicate the layout for generated code for Lisp as well.
Thanks, that would be great. Yes, it makes most sense to test with and
without nativecomp, expecting improvement to be more significant in the
latter case (but as EQ is used by C code used by native-compiled Lisp, I
expect a small improvement there, too).
Pip
- Re: Improving EQ, (continued)
- Re: Improving EQ, Eli Zaretskii, 2024/12/12
- New "make benchmark" target, Stefan Kangas, 2024/12/12
- Re: New "make benchmark" target, Andrea Corallo, 2024/12/12
- Re: New "make benchmark" target, Pip Cet, 2024/12/12
- Re: New "make benchmark" target, Stefan Kangas, 2024/12/12
- Re: New "make benchmark" target, Andrea Corallo, 2024/12/13
Re: Improving EQ, Óscar Fuentes, 2024/12/12