Language performance benchmark be updated 2019/11/09

Jon Degenhardt jond at noreply.com
Sun Nov 17 21:42:37 UTC 2019


On Sunday, 17 November 2019 at 16:25:52 UTC, Daniel Kozak wrote:
>> So basically the only critical change was to replace the 
>> built-in associative arrays with Appender types?
>>
>> That's really amazing!
>
> Not only, other change is not filling number AA with UNVISITED, 
> the other change is to disable parallel GC, because it is cause 
> performance decrease

Regarding the benefits seen from switching from AAs to Appenders 
- This is a nice performance improvement. Also a nice example of 
often available performance improvements in D programs.

At a high level, I feel I've seen this pattern a number of times. 
When people starting with D run benchmarks as part of their 
initial experiments, they naturally start with the simplest and 
most straightforward programming approaches. Nothing wrong with 
this. It's a strength of D that quality code can be written 
quickly.

However, in many cases these simple approaches allocate a fair 
bit of GC memory, memory that becomes unused quickly and needs to 
be GC collected. Again, nothing wrong with this. But, I have the 
impression that many times there is an expectation that such code 
will perform similarly to code using manually managed memory in 
other native compiled languages. And often this expectation is 
not met, as memory allocation and use patterns are a major 
performance driver.

What often gets missed in these assessments is that D has quite a 
few mechanisms available to enable better memory management use, 
without needing to drop GC paradigms entirely and move to fully 
manually managed memory. Modifying performance sensitive programs 
to use these mechanisms is often not hard. The switch here from 
AAs to Appenders is an example.

Being able to improve program performance in this way is a 
strength of D. One consideration is that until one has some 
experience with the language, it may not be obvious that these 
options exist, and the specific changes and approaches that can 
be used. This can lead to perception issues if nothing else.

--Jon


More information about the Digitalmars-d mailing list