How fast is D compared to C++?

前端 未结 8 1892
陌清茗
陌清茗 2020-12-22 15:16

I like some features of D, but would be interested if they come with a runtime penalty?

To compare, I implemented a simple program that computes scalar products of m

8条回答
  •  生来不讨喜
    2020-12-22 16:12

    You can write C code is D so as far as which is faster, it will depend on a lot of things:

    • What compiler you use
    • What feature you use
    • how aggressively you optimize

    Differences in the first aren't fair to drag in. The second might give C++ an advantage as it, if anything, has fewer heavy features. The third is the fun one: D code in some ways is easier to optimize because in general it is easier to understand. Also it has the ability to do a large degree of generative programing allowing things like verbose and repetitive but fast code to be written in a shorter forms.

提交回复
热议问题