December 20, 2018
On Wednesday, 19 December 2018 at 21:11:06 UTC, drug wrote:
> On 20.12.2018 0:01, jmh530 wrote:
>> 
>> What you really need is a tool that will show you the generated code from mixins/templates/ctfe for testing purposes. I don't think you're the only one...
>
> https://dlang.org/changelog/2.084.0.html#debugmixins

News to me. Thanks!
December 20, 2018
On 12/19/18 5:52 PM, bauss wrote:
> On Wednesday, 19 December 2018 at 17:42:00 UTC, H. S. Teoh wrote:
>> On Wed, Dec 19, 2018 at 10:28:59AM -0500, Steven Schveighoffer via Digitalmars-d wrote: [...]
>>> I'm curious if the author has any words to say on vibe.d compile times. If they value fast compile times over performance, I can't imagine they are using diet templates.
>> [...]
>>
>> Yeah, in my own vibe.d project I eventually separated out diet templates into their own modules that are separated from "business logic". Which I should be doing anyway, I suppose, in the spirit of good software design, but the primary motivation at the time was to keep compilation times under control.
>>
>> I'm quite tempted to cook up my own HTML generation framework that does codegen as a separate step, using D tools to generate D code, that then gets compiled into the actual executable. Despite all the power of CTFE and other compile-time features, past a certain level of complexity I really want to physically see the generated code rather than wade through inscrutable templates and mixins and try to imagine in my head what the generated code looks like. (You wouldn't believe it, debugging is SO MUCH easier when you don't have to instantiate templates in your head just to understand what the code is trying to do, but can just look at the actual generated code being fed to the compiler as a file.)
>>
>>
>> T
> 
> Pretty much solved in Diamond.
> 
> https://diamondmvc.org/
> 
> Basically: https://github.com/DiamondMVC/Diamond/blob/master/app/web.d#L192
> 
> viewResult.source is the exact generated source for a specific view.

What are the compile-time penalties for diamond templates? I have to try it one of these days.

I think diet templates are great, but the compile-time penalty is so bad. I really think they would be more palatable if they were processed pre-compilation. Parsing and cross-compiling a DSL right in the compiler is a neat trick, but there are certainly better ways to do it than with mixins and CTFE.

-Steve
December 20, 2018
On Thursday, 20 December 2018 at 14:39:32 UTC, Steven Schveighoffer wrote:
> On 12/19/18 5:52 PM, bauss wrote:
>> On Wednesday, 19 December 2018 at 17:42:00 UTC, H. S. Teoh wrote:
>>> On Wed, Dec 19, 2018 at 10:28:59AM -0500, Steven Schveighoffer via Digitalmars-d wrote: [...]
>>>> I'm curious if the author has any words to say on vibe.d compile times. If they value fast compile times over performance, I can't imagine they are using diet templates.
>>> [...]
>>>
>>> Yeah, in my own vibe.d project I eventually separated out diet templates into their own modules that are separated from "business logic". Which I should be doing anyway, I suppose, in the spirit of good software design, but the primary motivation at the time was to keep compilation times under control.
>>>
>>> I'm quite tempted to cook up my own HTML generation framework that does codegen as a separate step, using D tools to generate D code, that then gets compiled into the actual executable. Despite all the power of CTFE and other compile-time features, past a certain level of complexity I really want to physically see the generated code rather than wade through inscrutable templates and mixins and try to imagine in my head what the generated code looks like. (You wouldn't believe it, debugging is SO MUCH easier when you don't have to instantiate templates in your head just to understand what the code is trying to do, but can just look at the actual generated code being fed to the compiler as a file.)
>>>
>>>
>>> T
>> 
>> Pretty much solved in Diamond.
>> 
>> https://diamondmvc.org/
>> 
>> Basically: https://github.com/DiamondMVC/Diamond/blob/master/app/web.d#L192
>> 
>> viewResult.source is the exact generated source for a specific view.
>
> What are the compile-time penalties for diamond templates? I have to try it one of these days.
>
> I think diet templates are great, but the compile-time penalty is so bad. I really think they would be more palatable if they were processed pre-compilation. Parsing and cross-compiling a DSL right in the compiler is a neat trick, but there are certainly better ways to do it than with mixins and CTFE.
>
> -Steve

Not a lot I'd say. On my laptop (Nothing fancy, just 4gb ram.) it takes under 10 seconds to build the whole Diamond website.

First build is always slow though, but after that it's pretty smooth.

On my projects I usually don't really wait a lot because while it builds I usually change css etc. so by the time it has built the project I can test it.

I'm having some ideas on how to speed it up though by only compiling views that have changed, but it's a little more tricky than it sounds, so right now it's just an idea.
1 2
Next ›   Last »