Ideas for Phobos., u++ STL speed comparison

Jay Norwood jayn at prismnet.com
Sat Mar 17 23:44:02 PDT 2012


On Friday, 16 March 2012 at 14:26:19 UTC, Andrei Alexandrescu 
wrote:
> On 3/16/12 8:39 AM, Jay Norwood wrote:
>> On Friday, 16 March 2012 at 13:20:39 UTC, Jay Norwood wrote:
>>
>> btw, the u++ page claims in the link below to be faster than D 
>> by 70% on
>> some operations, which they attribute to their STL rewrite. 
>> Maybe
>> someone should take a look at what they've done. Or maybe this
>> comparison is out of date...
>>
>> http://www.ultimatepp.org/www$uppweb$vsd$en-us.html
>
> The test uses a specific data structure, an indexed contiguous 
> array. To conclude from here that C++ is faster than D is quite 
> a stretch.
>
> Andrei

Ok, but maybe the the upp arrayMap is pretty efficient for 
certain things ... by their benchmarks 4x faster than STL on 
whatever they were doing.  I tried  rewriting the D example code, 
and upp is consistently a bit  faster when running on a single 
core.
http://www.ultimatepp.org/src$Core$ArrayMap$en-us.html

  A D std.parallelism library rewrite of the example runs about 2x 
faster than the current upp example code on a corei7 box, if you 
give it several files to work on.  The execution doesn't scale as 
much as I expected, probably because the dictionary gets 
duplicated in the parallel case, while the single thread just 
increments counts in the same dictionary.

  I believe the TDPL book mentioned some research on non-locking, 
shared memory containers, but I didn't see anything documented in 
the D libraries.  There is the workerLocalStorage area ... but it 
wouldn't help with the problem of the dictionary getting 
duplicated in this case.  It look like there would be a reduce 
step required to merge the dictionary counts at the end.







More information about the Digitalmars-d mailing list