Slow start up time of runtime

bauss jj_1337 at live.dk
Tue Mar 20 12:07:12 UTC 2018


On Tuesday, 20 March 2018 at 10:46:11 UTC, Dennis wrote:
> On Tuesday, 20 March 2018 at 10:20:55 UTC, Dennis wrote:
>> On Tuesday, 20 March 2018 at 09:51:09 UTC, bauss wrote:
>>> Besides if it was and it took 1 second to startup, then it 
>>> wouldn't matter in practice with an actual application.
>>
>> This is not concerning for large applications indeed. But say, 
>> I want to implement my own `dir` (= `ls` on Unix) in D. Would 
>> you want to use it if it took a full second every time you 
>> wanted to quickly view a folder's contents?
>
> To give some more context, I've been using some of the digital 
> mars utilities and I admire their speed. A `grep -r "goto" *.d` 
> could find and scan 1.7 MB of d-source files in 190ms, way 
> before my D hello-world was even able to enter main. As far I 
> know, these are just C programs. I wonder if I could make such 
> fast utilities in D, or whether (idiomatic) D is not the right 
> tool for this and I should use (better)C instead.

Have you tried other applications that doesn't just print and see 
if that matters?

Try to write to a file instead of the standard output and see if 
that makes any difference between each compilation unit.

Also remember that you don't compile with dmd for runtime speed, 
but compilation speed. For runtime speed you want to use ldc, 
since it optimizes code way better.


More information about the Digitalmars-d-learn mailing list