Any update?

Thanks and Regards, Markus



Am 30.07.24 um 09:56 schrieb Jonathan Wakely:


On Tue, 30 Jul 2024, 06:21 Ehrnsperger, Markus, <markus_ehrnsper...@yahoo.de> wrote:

    On 2024-07-29 12:16, Jonathan Wakely wrote:

    > On Mon, 29 Jul 2024 at 10:45, Jonathan Wakely
    <jwakely....@gmail.com> wrote:
    >> On Mon, 29 Jul 2024 at 09:42, Ehrnsperger, Markus
    >> <markus_ehrnsper...@yahoo.de> wrote:
    >>> Hi,
    >>>
    >>>
    >>> I'm attaching two files:
    >>>
    >>> 1.:   to_chars10.h:
    >>>
    >>> This is intended to be included in libstdc++ / gcc to achieve
    performance improvements. It is an implementation of
    >>>
    >>> to_chars10(char* first, char* last,  /* integer-type */ value);
    >>>
    >>> Parameters are identical to std::to_chars(char* first, char*
    last,  /* integer-type */ value, int base = 10 ); . It only works
    for base == 10.
    >>>
    >>> If it is included in libstdc++, to_chars10(...) could be
    renamed to std::to_chars(char* first, char* last,  /* integer-type
    */ value) to provide an overload for the default base = 10
    >> Thanks for the email. This isn't in the form of a patch that we can
    >> accept as-is, although I see that the license is compatible with
    >> libstdc++, so if you are looking to contribute it then that
    could be
    >> done either by assigning copyright to the FSF or under the DCO
    terms.
    >> See https://gcc.gnu.org/contribute.html#legal for more details.
    >>
    >> I haven't looked at the code in detail, but is it a similar
    approach
    >> to https://jk-jeon.github.io/posts/2022/02/jeaiii-algorithm/ ?
    >> How does it compare to the performance of that algorithm?
    >>
    >> I have an incomplete implementation of that algorithm for libstdc++
    >> somewhere, but I haven't looked at it for a while.
    > I took a closer look and the reinterpret_casts worried me, so I
    tried
    > your test code with UBsan. There are a number of errors that would
    > need to be fixed before we would consider using this code.

    Attached are new versions of to_chars10.cpp, to_chars10.h and the new
    file itoa_better_y.h


Thanks! I'll take another look.



    Changes:

    - I removed all reinterpret_casts, and tested with
    -fsanitize=undefined

    - I added itoa_better_y.h from
    https://jk-jeon.github.io/posts/2022/02/jeaiii-algorithm/ to the
    performance test.

    Note: There is only one line in the benchmark test
    for itoa_better_y due
    to limited features of itoa_better_y:

    Benchmarking random unsigned 32 bit  itoa_better_y   ...


    to_chars10.h: Signed-off-by: Markus Ehrnsperger
    <markus_ehrnsper...@yahoo.de>

    The other files are only for performance tests.

    >
    >
    >>
    >>> 2.:  to_chars10.cpp:
    >>>
    >>> This is a test program for to_chars10 verifying the
    correctness of the results, and measuring the performance. The
    actual performance improvement is system dependent, so please test
    on your own system.
    >>>
    >>> On my system the performance improvement is about factor two,
    my results are:
    >>>
    >>>
    >>> Test   int8_t verifying to_chars10 = std::to_chars ... OK
    >>> Test  uint8_t verifying to_chars10 = std::to_chars ... OK
    >>> Test  int16_t verifying to_chars10 = std::to_chars ... OK
    >>> Test uint16_t verifying to_chars10 = std::to_chars ... OK
    >>> Test  int32_t verifying to_chars10 = std::to_chars ... OK
    >>> Test uint32_t verifying to_chars10 = std::to_chars ... OK
    >>> Test  int64_t verifying to_chars10 = std::to_chars ... OK
    >>> Test uint64_t verifying to_chars10 = std::to_chars ... OK
    >>>
    >>> Benchmarking test case               tested method  ...  time
    (lower is better)
    >>> Benchmarking random unsigned 64 bit to_chars10     ...  0.00957
    >>> Benchmarking random unsigned 64 bit std::to_chars  ...  0.01854
    >>> Benchmarking random   signed 64 bit to_chars10     ...  0.01018
    >>> Benchmarking random   signed 64 bit std::to_chars  ...  0.02297
    >>> Benchmarking random unsigned 32 bit to_chars10     ...  0.00620
    >>> Benchmarking random unsigned 32 bit std::to_chars  ...  0.01275
    >>> Benchmarking random   signed 32 bit to_chars10     ...  0.00783
    >>> Benchmarking random   signed 32 bit std::to_chars  ...  0.01606
    >>> Benchmarking random unsigned 16 bit to_chars10     ...  0.00536
    >>> Benchmarking random unsigned 16 bit std::to_chars  ...  0.00871
    >>> Benchmarking random   signed 16 bit to_chars10     ...  0.00664
    >>> Benchmarking random   signed 16 bit std::to_chars  ...  0.01154
    >>> Benchmarking random unsigned 08 bit to_chars10     ...  0.00393
    >>> Benchmarking random unsigned 08 bit std::to_chars  ...  0.00626
    >>> Benchmarking random   signed 08 bit to_chars10     ...  0.00465
    >>> Benchmarking random   signed 08 bit std::to_chars  ...  0.01089
    >>>
    >>>
    >>> Thanks, Markus
    >>>
    >>>
    >>>

Reply via email to