
On 2011.05.24_16.52.00, Phil Bouchard wrote:
FYI make_shared is slower than new because of the temporary it creates. If people what speed they should stick to operator new in all cases.
My box begs to differ. Units for min, max, mean and moment are: shared_ptrs created / 8 seconds Count is: number of trials Sum is: shared_ptrs created / (numer of trials * 8 seconds) GCC 4.4.5: make_shared: min = 38176474 max = 40958919 mean = 3.95662e+07 count = 8 sum = 316529282 moment<2> = 1.56663e+15 new: min = 32075900 max = 35917824 mean = 3.41757e+07 count = 8 sum = 273405391 moment<2> = 1.16916e+15 Intel C++ 12.0 make_shared: min = 38264052 max = 40850617 mean = 4.0022e+07 count = 8 sum = 320176020 moment<2> = 1.6026e+15 new: min = 33708800 max = 35364869 mean = 3.47297e+07 count = 8 sum = 277837391 moment<2> = 1.20645e+15 Clang 2.8 make_shared: min = 35269466 max = 37759937 mean = 3.69983e+07 count = 8 sum = 295986798 moment<2> = 1.3695e+15 new: min = 32876828 max = 34609212 mean = 3.38261e+07 count = 8 sum = 270608628 moment<2> = 1.14456e+15 lll-clang 3.0 make_shared: min = 34756169 max = 37310038 mean = 3.66762e+07 count = 8 sum = 293409533 moment<2> = 1.34575e+15 new: min = 33098433 max = 34011625 mean = 3.37868e+07 count = 8 sum = 270294200 moment<2> = 1.14162e+15 Equipment and kernel: HP ProLiant DL785 G6 Server 8 AMD Socket Fs, 6 Opteron 8431s per socket w/ HyperTransport Cache sizes per socket: L1 384kB, L2 3072kB, L3 5120kB 96 gigs main memory, 100ish gigs swap RHEL 6.0 (Linux 2.6.32), sits at runlevel 3 Boost from top of trunk No other jobs were running at the time. Peak memory usage for one invocation of the benchmark program is appx 60 gigs. Source code attached. -- Bryce Lelbach aka wash boost-spirit.com px.cct.lsu.edu github.com/lll-project