Thoughts from newcommer

prdan via Digitalmars-d digitalmars-d at puremagic.com
Mon Apr 17 19:57:59 PDT 2017


I've written multi-threaded regex-redux benchmark for D language 
and made some tests. This is my first program written in D, I 
didn't know much about D a week ago.

Here are the results for other languages:

http://benchmarksgame.alioth.debian.org/u64q/regexredux.html

I have newer CPU than one used on this page. Tests were made on 
Debian 8 with i7-3770 3.4 Ghz (4C/8T) CPU.

I've tested C and Rust besides D becasue those are the top two 
languages on this benchmark.

Rust version 1.16 (newest stable)
GCC ver 4.9.2 (newest debian 8 stable)

I've changed target-cpu in Rust compile command to match my cpu.

C was the fastest (1.32) but used the most CPU, D was second 
(1.45) with lowest CPU usage!, Rust was third (1.55). In this 
benchmark D is faster than any other language besides C.

Code in D is very clean and readable, GC is operating normally.


Exacts results are below:

D
   User time (seconds): 1.91
         System time (seconds): 0.14
         Percent of CPU this job got: 140%
         Elapsed (wall clock) time (h:mm:ss or m:ss): 0:01.45
         Average shared text size (kbytes): 0
         Average unshared data size (kbytes): 0
         Average stack size (kbytes): 0
         Average total size (kbytes): 0
         Maximum resident set size (kbytes): 263848

Rust

   User time (seconds): 2.72
         System time (seconds): 0.09
         Percent of CPU this job got: 181%
         Elapsed (wall clock) time (h:mm:ss or m:ss): 0:01.55
         Average shared text size (kbytes): 0
         Average unshared data size (kbytes): 0
         Average stack size (kbytes): 0
         Average total size (kbytes): 0
         Maximum resident set size (kbytes): 199008

C
     User time (seconds): 4.51
         System time (seconds): 0.08
         Percent of CPU this job got: 346%
         Elapsed (wall clock) time (h:mm:ss or m:ss): 0:01.32
         Average shared text size (kbytes): 0
         Average unshared data size (kbytes): 0
         Average stack size (kbytes): 0
         Average total size (kbytes): 0
         Maximum resident set size (kbytes): 151716


I got inspired by those results that's why I thought I will write 
all the other benchmarks from benchmarks game also for D and 
share the code and results on github + comparison to couple other 
languages.


More information about the Digitalmars-d mailing list