[GSoC] 'Replace Runtime Hooks with Templates' progress and update thread

H. S. Teoh hsteoh at quickfur.ath.cx
Thu May 30 16:45:12 UTC 2019


On Thu, May 30, 2019 at 12:15:55PM +0000, Johannes Pfau via Digitalmars-d wrote:
[...]
> Now regarding this specific GSoC project: I don't think we have to
> worry that this will affect compilation speed a lot. The compiler code
> will be mostly identical, only instead of calling an extern(C)
> function, it calls a template. Simple template instantiations are not
> particularily slow though, so this should not cause much of a slow
> down.

That depends on how the template is implemented, doesn't it?  If there
are too many recursive templates, for example, the slowdown can be quite
dramatic.


> There is however one side-effect: Unlike the extern(C) functions used
> before, template instances will be visible to the optimizer. This
> means that parts of these hooks can be inlined and optimized to
> improve performance. This however might affect compile time a bit.
[...]

There's also the issue of code bloat, which should at least be
considered, even if actually solving it might complicate things a bit
too much for GSoC.  Previously copying an array from A to B involved
only a single runtime function; now we're looking at O(n) template
instantiations, which potentially translates to O(n) functions that,
ostensibly, do the exact same copying of some number of bytes from A to
B.


T

-- 
People demand freedom of speech to make up for the freedom of thought which they avoid. -- Soren Aabye Kierkegaard (1813-1855)


More information about the Digitalmars-d mailing list