[Issue 9725] New: std.string.format does wasteful UTF decoding

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 14 21:14:19 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9725

           Summary: std.string.format does wasteful UTF decoding
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: performance
          Severity: normal
          Priority: P3
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: thecybershadow at gmail.com


--- Comment #0 from Vladimir Panteleev <thecybershadow at gmail.com> 2013-03-15 06:14:17 EET ---
import std.string; void main() { format("\xFF"); }

This program throws, indicating that the "format" function performs UTF-8
decoding.

This is a pointless waste of cycles. All format specifiers are in the
lower-ASCII range, and both the input and output are UTF-8. Should the format
specifier syntax require reading exactly one Unicode character, it should do so
when required, rather than reading the entire string one dchar at a time, then
encoding the results back into an UTF-8 string.

It is worth noting that writefln does not have the same issue.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list