develooper Front page | perl.perl5.porters | Postings from October 2018

[perl #133511] [PATCH] tiny optimization of pp_divide

Thread Next
From:
Tony Cook via RT
Date:
October 11, 2018 23:57
Subject:
[perl #133511] [PATCH] tiny optimization of pp_divide
Message ID:
rt-4.0.24-22040-1539302249-179.133511-15-0@perl.org
On Tue, 11 Sep 2018 22:52:46 -0700, me@xenu.pl wrote:
> This patch marginally speed-ups division of large integers in perl. The
> change is extremely simple and explained in the commit message:

Perhaps it could use a comment indicating that many modern optimizing compilers combine the div and mod into one instruction.

I could see myself seeing that code in a few years and wondering it was using a (relatively) slow[1] div rather than a mul.

If I go to an older compiler like clang 4.0.1, I end up with two div instructions with your patch rather than a div and a mul.

Tony

[1] see the latencies for mul vs div on SkylakeX at https://www.agner.org/optimize/instruction_tables.pdf for example.

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=133511

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About