On Friday 17 July 2015 11:18:06 Marc Mutz wrote:
> On Friday 17 July 2015 11:00:49 Marc Mutz wrote:
> [...]
> 
> > I've attached my local version, which includes some Qt containers.
> 
> [...]
> 
> That version was some bitrot. Here's the one that works. It also varies the
> number of duplicates to be removed.

The exact operation performed is

  sort | uniq

> This kind of benchmark, together with a nice visualisation, and more use-
> cases, is what I'd wish we had for our users.

Here are the results of running it on a Core-i7 Sandy Bridge pinned at 2.4GHz, 
formatted as HTML. "Excesss dups" of 1 means no duplicates, 100 means 99% 
dups.

It is instructive to look at the memory consumption, because the size printed 
is the size of the *reduced* container, so the largest container size is 100 
million elements, 1% of which are unique, 99% dups. That's 800M in vector, 
qlist, qvector, deque, but _a lot_ more in std::list (2400M + allocator 
overhead, on my machine 3.8G of resident memory), set, and multiset (3200M + 
allocator overhead, on my machine 5.2G). Conseqently, don't run this without 
at least 6G of RAM or reduce the max. working set size.

As you can see, the only algorithm that can hold up with 
std::vector+std::sort+std::uniue is QSet+QList+std::osrt, but only at very 
high number of duplicates (starts here for some medium sizes and 90% dups), 
and even at its best, it's "only" 3x faster than std::vector, while it can be 
an order of magnitude slower. I find it particularly interesting that at 
100'000 elements and 99% dups, it's almost as slow as std::vector, and at 
1'000'000 elements, slower again.

-- 
Marc Mutz <[email protected]> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt Experts
Title: Container Benchmark
excess elements:1
sizearrayvector with pointersvector with iteratorsqvector with pointersqvector with iteratorsdequelistqlistsetqset->qlistmultiset
100.070.070.070.110.120.180.510.140.380.710.42
1000.030.040.030.050.050.080.260.070.240.390.24
10000.050.040.060.060.060.110.260.070.290.340.31
100000.100.100.110.100.110.140.300.120.350.370.38
1000000.100.100.110.110.110.130.420.120.490.370.52
10000000.100.100.100.110.110.130.590.270.840.820.93
excess elements:2
sizearrayvector with pointersvector with iteratorsqvector with pointersqvector with iteratorsdequelistqlistsetqset->qlistmultiset
100.320.140.160.200.210.311.040.310.510.900.92
1000.060.070.070.100.100.160.560.140.310.490.58
10000.180.180.180.200.200.290.590.240.490.450.71
100000.230.220.240.240.240.300.680.260.630.430.85
1000000.220.220.220.230.230.291.080.260.860.431.37
10000000.220.210.230.220.220.281.260.591.570.932.03
excess elements:5
sizearrayvector with pointersvector with iteratorsqvector with pointersqvector with iteratorsdequelistqlistsetqset->qlistmultiset
100.700.310.320.470.460.692.510.700.791.402.65
1000.190.200.210.270.260.441.720.390.720.732.10
10000.590.590.610.650.640.841.670.741.070.622.15
100000.620.610.630.640.640.791.910.721.410.572.58
1000000.570.580.610.600.600.754.360.722.130.704.98
10000000.570.590.590.600.590.733.841.643.871.136.27
excess elements:10
sizearrayvector with pointersvector with iteratorsqvector with pointersqvector with iteratorsdequelistqlistsetqset->qlistmultiset
100.570.560.620.850.861.355.251.351.263.525.85
1000.480.480.670.630.631.293.930.921.661.115.03
10001.251.261.281.341.411.713.801.542.010.915.28
100001.221.221.271.281.271.574.911.432.740.806.68
1000001.151.301.201.191.231.4810.331.484.101.1912.14
10000001.161.161.201.201.191.469.123.488.251.7714.79
excess elements:20
sizearrayvector with pointersvector with iteratorsqvector with pointersqvector with iteratorsdequelistqlistsetqset->qlistmultiset
101.271.241.321.821.822.9511.372.902.414.0013.50
1002.012.022.082.332.293.498.762.953.451.8911.49
10002.572.572.662.742.753.438.823.193.861.4512.25
100002.402.552.672.512.503.1013.953.045.401.3118.18
1000002.492.322.442.572.422.9924.503.088.492.2230.31
10000002.332.352.442.412.562.9319.677.2815.493.0034.36
excess elements:50
sizearrayvector with pointersvector with iteratorsqvector with pointersqvector with iteratorsdequelistqlistsetqset->qlistmultiset
103.563.503.514.854.857.3132.097.836.608.5441.65
1006.616.626.697.387.319.7324.608.838.824.4333.47
10006.596.606.786.936.948.6425.688.049.392.9637.02
100006.076.076.316.486.518.2055.037.2713.432.8263.57
1000006.236.086.316.426.438.0073.258.1820.725.9494.72
10000005.855.996.246.006.157.4156.9520.3538.707.04106.47
excess elements:100
sizearrayvector with pointersvector with iteratorsqvector with pointersqvector with iteratorsdequelistqlistsetqset->qlistmultiset
108.418.367.7110.6010.5817.4870.8216.3717.7816.2092.57
10014.0614.0414.3515.3615.3420.0656.3218.5217.848.4380.50
100012.7812.8013.2113.4513.4416.9062.4715.6618.655.5391.59
1000012.2012.1912.6212.7412.7315.81137.6014.7026.425.55162.82
10000012.1012.0912.5512.4512.4615.29166.1616.0939.9611.18225.32
100000011.7511.7412.2012.0512.0614.57129.5243.6678.0614.62250.44
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to