template statistics
Adam D. Ruppe
destructionator at gmail.com
Wed Jun 3 14:04:23 UTC 2020
On Wednesday, 3 June 2020 at 03:19:37 UTC, Walter Bright wrote:
> The thing is, `writeln("hello")` can be expanded to
> `core.stdc.stdio.puts("hello")`. Done.
iff it is a string literal and only a string literal. tho the
zero-terminator can be fixed with fwrite of course.
> Phobos seems to do a lot of "going around the Horn" instead of
> taking the canal.
It actually tries to special-case string literals (and it does a
fine job - the compile time on my computer is scarcely different
than using `core.stdc.stdio`), but turns out this is trickier
than it might seem since there's a lot of edge cases in real
generic D code.
On Linux, this generic implementation costs about 0.04s in
compile time. On Windows, it costs about 0.08s (which is probably
more the cost of importing core.sys.windows.windows than anything
else).
tbh I think this case looks worse than it is.
More information about the Digitalmars-d
mailing list