Live data from Hacker News

Using D to Create the World’s Fastest File System

dlang.org

151–160 of 167 posts

Re: Using D to Create the World’s Fastest File System

#151

Earlier quoted context omitted.

My experience, which of course is anecdotal, is that the advantage is it's easy to change the algorithms and data structures. I've maintained C and C++ code bases for decades, and I've found that the first algorithm I tried has stayed there in the code. It gets tweaked, optimized, refactored, but it's the same algorithm and data structure. With D, when I developed the Warp preprocessor, https://github.com/facebookarc…

> In D, . is used for both Also for module access (as opposed to :: in c++). I feel like d has a lot (too much?) of syntax but this is one place where it manages to cut down on it a bit.

D has significantly less syntax than C++, it barely has more than C. The weirdest syntax to get used to in my experience is the template stuff, most everything else is fairly natural. and even then the template stuff is way less complex (but no less powerful) than C++.

Re: Using D to Create the World’s Fastest File System

#152

Earlier quoted context omitted.

> My point is that "standard" code is infinitely more readable than either c++ or rust. Still I'm struggling to see any code that is significantly more readable because of D's design decisions , or details on what makes D more readable than $lang (especially compared to modern C++/Rust that you seem to despise so much).

1. Template syntax. For example, a struct template in D is: struct S(T) { ... } A function template is: T func(T)(T t) { ... } 2. No forward reference declarations required. This cuts down on a mass of unnecessary boilerplate. Even better, it allows the coding style of ordering the functions from most important to least important, rather than the reverse that is typical of C/C++ source files. 3. Terser declarations:…

I already find function template syntax (1) a bit more confusing because of consecutive parentheses (I can get used to it pretty easily, but it will always be a bit slower to read), and 2–6 does not make me want to convert to D from Rust.

Re: Using D to Create the World’s Fastest File System

#153

Earlier quoted context omitted.

The main reason the way I see it is that a lot of people who still use C and C++ need maximum speed, and D is only memory-safe with its garbage collector enabled. This affects latency and adds overhead. For many cases using a garbage collector is fine, but D was trying to target video games and other spaces where the GC was not acceptable. So D allows you to turn the GC off, but then it's just a vastly less-mature C+…

Actually GC can decrease overhead depending on your use of memory since it only frees when memory when it's needed.

> GC ... only frees when memory when it's needed.

This is actually one of the worst features of GC where game development is concerned. Memory usage isn't the main problem to be solved in game engines, it's consistency of execution time.

In that context, even if you're spending more resources on memory allocation/deallocation overall, it's much better to know that you can consistently fit that overhead into the 16 milliseconds you have for this frame rather than having it mediated by a system you do not have direct control over.

There are also other advantages to having more direct control over memory management than is typically allowed by garbage-collected languages. For instance, CPU cache-coherency can be a major performance concern when dealing with the type of computation required for games. Without being able to lay out memory and deal with memory in a precise way, there are whole categories of optimization which are not really possible.

Re: Using D to Create the World’s Fastest File System

#154
post #135
post #91

Earlier quoted context omitted.

Its not hostile. Its aggressive in selling the strong points of the language. Having said that, I do wish newer languages spring up that adapt the good stuff from Rust. I can never like Rust syntax.

A ludicrous amount of engineering has gone into the Rust compiler, the extensive documentation in RFCs about its design, the huge language docs that took a million man hours to make, RLS is another huge undertaking... I do forsee Rust getting a Coffeescript of its own. I'm in love with the control flow model of the language but always felt some things that were in from day one (like double colon :: namespace delimite…

I totally agree re the ergonomics. It really feels to me as if a lot of C/C++ conventions were copied over, with no justification beyond "this is what system programming languages look like".

Re: Using D to Create the World’s Fastest File System

#155
post #68

I have wondered for awhile now why Rust is getting all this attention of being "Like C but safe and cool!", but no one would mention D. I personally don't do systems programming because I'm not smart enough but the little bit I have done, I found D to be the most-natural feeling (even over Rust), and D has been around a lot longer. I suppose timing is everything for these kinds of things.

Rust brought something new that no other language had: memory safety through statically enforcing object ownership and borrowing. Anyone who has done manual memory management already is familiar with those concepts, and how difficult that can be to track in large systems. Whenever a language is able to abstract pervasive concepts to first-class entities in a language, it becomes attractive to people who deal with tho…

I'm excited for Rust because it might be finally time for a better safer embedded language (no GC is basically required here) and I like using it for little tools where I process huge text files.

Zero copy (in a safe way) makes everything super high speed.

Re: Using D to Create the World’s Fastest File System

#156
post #147

Earlier quoted context omitted.

Where do you see that happening? I'd love to tell some people to cut it out!

In this post about D, the top comments are about how great Rust is. But mentioning D in a post about Rust is like sticking your head into a bee-hive.

The top comment is about how much they love D, and wonder why others don’t. So people are answering that question.

I don’t see how that’s the Rust community hating other languages, but answering a question about preference. They’re all respectful answers.

I don’t see it here, sorry :/

Re: Using D to Create the World’s Fastest File System

#157
post #148

Earlier quoted context omitted.

Only the scripting code is GCed. The core engine in both cases is C++ with manual memory management for the reasons stated above.

On Unity's case with some subsystems in the process of being replaced by HPC#. And in Unreal you can use GC in whatever components you feel like, it is a matter of weighting where it makes sense.

> On Unity's case with some subsystems in the process of being replaced by HPC#.

They are converting their C# code to HPC# which specifically does not do GC allocations.

https://youtu.be/NF6kcNS6U80?t=886

  HPC#:
   * no class types
   * no boxing
   * no GC allocation
   * not exceptions for control flow
They are building a compiler to eliminate the GC from the GC'd language they were using.

Re: Using D to Create the World’s Fastest File System

#158
post #148

Earlier quoted context omitted.

On Unity's case with some subsystems in the process of being replaced by HPC#. And in Unreal you can use GC in whatever components you feel like, it is a matter of weighting where it makes sense.

> On Unity's case with some subsystems in the process of being replaced by HPC#. They are converting their C# code to HPC# which specifically does not do GC allocations. https://youtu.be/NF6kcNS6U80?t=886 HPC#: * no class types * no boxing * no GC allocation * not exceptions for control flow They are building a compiler to eliminate the GC from the GC'd language they were using.

Once upon a time, C code for games engines looked like this.

    void do_stuff(void) {
        asm {
        }
    }
Hardly any C code in sight, and most of the stuff could equally have been coded in MASM/TASM with their higher level macros.

Eventually game devs migrated to proper C.

A couple of years later, C++ code in game engines, was not even "C with Classes", rather C compiled with C++ compiler.

Eventually game devs migrated to proper C++.

Looking at the past, which I was partially part of, I see HPC# as a stepping stone into regular C#, in a similar vein that C code of yore was full of inline Assembly.

It is of course a matter of opinion, however I like to look at the past to see where the future leads to.

So lets see who's is right in about 10 years, regarding how game engines get implemented.

Re: Using D to Create the World’s Fastest File System

#159

I discovered D is a secret weapon at several companies, but not all of them want to make it widely known...

why is it in a company's best interest to not evangelize the publicly-available tools it uses? Microsoft/Amazon/Google are paying $$$ to increase availability of AI/machine learning education, because they want a knowledge pool to hire from. Wouldn't this be the same with languages?

>why is it in a company's best interest to not evangelize the publicly-available tools it uses?

Because they want people that are good with the tool, not people that crash-coursed/bootcamped their way into what they are told is a marketable skill.

Re: Using D to Create the World’s Fastest File System

#160
post #91
post #80

Earlier quoted context omitted.

The Rust community is extremely hostile, especially against other languages, and D in particular.

Its not hostile. Its aggressive in selling the strong points of the language. Having said that, I do wish newer languages spring up that adapt the good stuff from Rust. I can never like Rust syntax.

It would be ironic if D language did precisely that.
Post reply on HN