[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Built-in base2dec and dec2base
From: |
Daniel J Sebald |
Subject: |
Re: Built-in base2dec and dec2base |
Date: |
Sun, 29 Jul 2012 23:30:16 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16 |
I've done a first pass of built-in versions of base2dec() and
dec2base(), and I put a patch in the features portion of SourceForge
Carnë informed me I used the wrong tracker. (Thanks Carnë.) I moved
the patch to:
https://savannah.gnu.org/patch/index.php?7825
...
I tested a version of dec2base that uses the C++ library div() routine
http://www.cplusplus.com/reference/clibrary/cstdlib/div/
to generate quotient and remainder at the same time. Where I thought it
might cut the computations some, it turns out to be slower than using
operate divide followed by multiply and subtract. My guess is that the
div() routine for some reason doesn't know how to optimize for the
processor or the CPU doesn't have remainder as part of its div
instruction. Consequently it just introduces extra overhead of the
div_t structure.
COMMAND BUILT-IN BUILT-IN
DIVIDE div_t
MULTIPLY div()
_______ ________ _______
dec2bin(<int vector>) 0.22697 0.25996
dec2bin(<cell vector>) 0.23996 0.28496
dec2hex(<int vector>) 0.11998 0.12998
dec2hex(<cell vector>) 0.13898 0.16198
dec2base(<int vec>, '01') 0.22497 0.24796
dec2base(<cell vec>, '01') 0.23996 0.28396
Dan