[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Improving EQ
From: |
Óscar Fuentes |
Subject: |
Re: Improving EQ |
Date: |
Thu, 12 Dec 2024 11:42:48 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Pip Cet via "Emacs development discussions." <emacs-devel@gnu.org>
writes:
> I looked at the "new" code generated for our EQ macro, and decided that
> a fix was in order. I'm therefore sending a first proposal to explain
> what I think should be done, and some numbers.
>
> This patch:
> * moves the "slow path" of EQ into a NO_INLINE function
> * exits early if the arguments to EQ are actually BASE_EQ
> * returns quickly (after a single memory access which cannot be avoided
> until we fix our tagging scheme to distinguish exotic objects from
> ordinary ones) when symbols_with_pos_enabled isn't true.
>
> The effect on the code size of the stripped emacs binary is small, but
> significant: 8906336 bytes instead of 8955488 bytes on this machine.
> (The effect on the code size of the emacs binary with debugging
> information is much larger, reducing it from 32182000 bytes to 31125832
> bytes on this system.) There is no effect on the size of the .pdmp
> file, which is expected.
>
> What's missing here is a benchmark, but unless there's a really nasty
> surprise when that happens, I'm quite confident that we can improve the
> code here.
I've seen too many cases where *removing* instructions (mind you,
literally removing, not changing!) made the code significantly slower.
Modern CPUs are insanely complex and combined with compilers make
intuition-based predictions even more futile.
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.
As for your patch, one thing that would be easy to do and might save
quite a lot of head scratching is to count the fraction of the calls to
EQ that benefit from the fast path on a "representative" Emacs run. Then
you would have hard data to decide if fighting the compiler/CPU on that
case is a worthy cause.
- Re: Improving EQ, (continued)
- Re: Improving EQ, Eli Zaretskii, 2024/12/12
- Re: Improving EQ, Visuwesh, 2024/12/12
- Re: Improving EQ, Andrea Corallo, 2024/12/12
- Re: Improving EQ, Pip Cet, 2024/12/12
- 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 <=