On Monday, September 09, 2013 18:58:47 Dmitry Olshansky wrote: > 09-Sep-2013 18:39, Joseph Rushton Wakeling пишет: > > On 09/09/13 16:34, Dmitry Olshansky wrote: > >> On the bright side of things std.regex is real fast on LDC *when > >> hacked* to > >> inline the critical bits :) > > > > Do you mean when manually inlined, or when the design is tweaked to > > facilitate inlining? > > When I put extra () to indicate that said functions are templates. > Then compiler gets its grip on them and finally inlines. > Otherwise it generates calls and links in object code from libphobos. > > Which is the whole reason for the topic - is THAT is the way to go? > Shouldn't compiler look into source for inlinable stuff (when source is > available)?
The compiler should definitely be able to look at non-templated functions and inline them where appropriate. I expect that it will really hurt performance in general if it doesn't - especially with stuff like getters or setters. I don't know what the best way would be for the compiler to go about doing that and have no idea how the inliner currently works, but I don't think that there's any question that it needs to. - Jonathan M Davis