Faster Command Line Tools in D

Wulfklaue via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Thu May 25 03:27:44 PDT 2017


On Thursday, 25 May 2017 at 06:22:28 UTC, Jon Degenhardt wrote:
> Thanks Walter, I appreciate your comments. And correct, as 
> multiple people noted, a speed comparison with other languages 
> not at all a goal of the article.
>
> The real intent was to tell a story of how several of D's 
> features play together to enable optimizations like this, 
> without having to write low-level code or step outside the core 
> language features and standard library.

Maybe as a more casual observer the article did feel more like 
Python vs D. I have not yet read the ycombinator comments, just 
from my personal observation after reading the article.

My thinking was:

- Python its PyPy is surprising fast.

- Surprised that D was slower in version 1.

- Kind of surprised again that it took so many versions to figure 
out the best approach.

- Also wondering why one needed std.algorithm splitter, when you 
expect string split to be the fasted. Even the fact that you need 
to import std.array to split a string simply felt  strange.

- So much effort for relative little gain ( after v2 splitter ). 
The time spend on finding a faster solution is in business sense 
not worth it. But not finding a faster way is simply wasting 
performance, just on this simple function.

- Started to wonder if Python its PyPy is so optimized that 
without any effort, your even faster then D. What other D 
idiomatic functions are slow?

I am not criticizing your article Jon, just mentioning how i felt 
when reading it yesterday. It felt like the solution was overly 
complex to find and required too much deep D knowledge. Going to 
read the ycombinator comments now.


Off-topic:

Yesterday i was struggling with split but for a whole different 
reason. Take in account that i am new at D.

Needed to split a string. Simple right? Search Google for "split 
string dlang". Get on the 
https://dlang.org/phobos/std_string.html page.

After seeing the splitLines and start experimenting with it. Half 
a hour later i realize that the wrong function was used and 
needed to import std.array split function.

Call it a issue with the documentation or my own stupidity. But 
the fact that Split was only listed as a imported function, in 
this mass of text, totally send me on the wrong direction.

As stated above, i expected split to be part of the std.string, 
because i am manipulating a string, not that i needed to import 
std.array what is the end result.

I simply find the documentation confusing with the wall of text. 
When i search for string split, you expect to arrive on the 
string.split page. Not only that, the split example are using 
split as a separate keyword, when i was looking for 
variable.split().

Veteran D programmers are probably going to laughing at me for 
this but one does feel a bit salty after that.


More information about the Digitalmars-d-announce mailing list