C/DataDraw smokes C++/STL on EDA-like benchmarks

B

Bill Cox

Hi, all.

I'm still coding in C for all my compute intensive EDA applications
after all these years, and here's why. I've recently benchmarked
DataDraw (datadraw.sf.net) graph databases vs GNU C++ graphs built
using STL lists. Large graphs (4 million nodes) were built in the
shape of a mesh. Then, simple depth first traversals were performed
starting from a corner, a hundred times.

The C/DataDraw based implementation ran 15X faster than the C++/STL
version, while using less than half the memory.

The performance difference is due mostly to cache-optimized memory
organization, which gave the DataDraw version a 16.7X lower L2 cache
miss rate, according to cachegrind. I estimate the DataDraw version
achieved around 30X higher useful information density in the cache.
This is due to several factors, which are roughly:

Keeping like data fields together, rather than object fields: 4X
Using a memory pool per field, rather than a global pool: 2X
Using 32-bit object references rather than 64-bit pointers: 2X
Embedding next pointers in edges rather than allocating link object:
2X

In short, C still provides the low-level manipulation hooks to write
ultra-high-performance code, while C++ add-ons have gone down a road
towards mediocre performance. The benchmarks can be found in the
expamples/graph_benchmark directory of the source code, which can be
checked out with:

svn co https://datadraw.svn.sourceforge.net/svnroot/datadraw/trunk
datadraw

Best regards,
Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top