memset and related things

bearophile bearophileHUGS at lycos.com
Sun Sep 20 15:16:37 PDT 2009


language_fan:

> Every time I see your benchmarks, Java is actually doing just 
> fine, sometimes it's even faster than D. Are your benchmarks somehow 
> flawed every time Java wins D in performance?

I don't fully understand your question. The main purpose of some of the benchmarks I've done in the last few months is to find performance bugs (or sometimes just bugs) in LDC or LLVM (I have stopped doing something similar for DMD because people look less interested in improving it performance).

Now often I use code originally written in C++ and Java because I've seen that in most situations LLVM is able to produce good binaries from very C-like code (with few exceptions).

My benchmarks aren't chosen randomly, I naturally focus on things that are slower in D, so sometimes you can see Java to "win". I usually discard the code where Java results slower :-)

Installing and using a debug build of the JavaVM to see the assembly its JIT produces is not handy, but I sometimes do it. Once in a while you can find some surprises there.

Recently I have found a nice single-file C++ program, that heavily uses templates and partial specialization, but I am having problems in translating it to good D to test templates in LDC because I don't know enough C++ yet. It finds the optimal solution to the 15 problems, and it's quite efficient:
http://codepad.org/96ATkuhx
Help/suggestions are welcome :-)

Bye,
bearophile



More information about the Digitalmars-d mailing list