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

Johannes Pfau nospam at example.com
Thu May 30 12:15:55 UTC 2019


Am Wed, 29 May 2019 19:08:56 +0000 schrieb Yatheendra:

> Thanks.
> 
> The reason I asked is, I remember the opposite of this approach being
> claimed as being a reason for fast compilation, i.e. having heavily-used
> features in the language instead of as templates in the standard
> library. Now, even as an implementation detail, it is a reversal in
> approach.

My observations here have been quite different, do you have a link / 
source to reinforce that statement?

I've been following these newsgroups for quite some time now and Andrei's 
and Walters stance on this was always to move as much functions out of 
the compiler into the library as possible. In addition, the compiler 
should not do any magic, instead it lowers to code which could also have 
been written by the user.

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.

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.

-- 
Johannes


More information about the Digitalmars-d mailing list