Uploaded image for project: 'Erlang/OTP'
  1. Erlang/OTP
  2. ERL-1470

Replace float_to_list and float_to_binary with ERTS Ryu Printf implementation

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: kernel
    • Labels:
      None

      Description

      Reimplement these BIF using Ryu Printf. https://github.com/ulfjack/ryu

      Today, these BIFs are implemented by calling into `snprintf` from stdio libc. To achieve this, they have to parse and build multiple formatting options string (i counted at least 3 different options string being parsed in this path), then call the libc (which is not a particularly efficient implementation) then do more formatting on the output to fit the needs of backward compatibility we provide and strip the output from the locales specific formatting that the libc does.

      On top of this, they only offer really limited formatting options, far more limited than what snprintf offer.

      We offer to implement these BIF using the Ryu Printf algorithm. It covers these two use case, should be able to fit in probably as much LOC than the current total LOC covering this use case, be an order of magnitude faster and allows for an easier to follow codebase and formatting of the output.

      It may also allow to specify properly the size of buffer, as the current one of 256 is probably or too big or too small.

      We could use the Microsoft STL test suite for charconv to build a test suite for this in OTP. https://github.com/microsoft/STL/tree/master/tests/std/tests/P0067R5_charconv

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              otp_team_vm Team VM
              Reporter:
              dianaolympos DianaOlympos
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated: