ABCDEFGHIJKLMNOPQRST
1
Capacity
2
Assuming I'm reading the code right:0
3
http://trac.webkit.org/browser/trunk/Source/WTF/wtf/Vector.h#L81216
4
C = max(16, C + C / 4 + 1)21
5
The table to the left shows the growth of a Vector<T>27
6
using append() to grow by one each time.34
7
newMinCapacity is basically ignored, as its always C+1 for append43
8
and the function on the right grows more than 1 at each step.54
9
68
10
86
11
108
12
136
13
171
14
214
15
268
16
336
17
421
18
527
19
659
20
824
21
This is the size the HTMLBackgroundParser stops at1031
22
after 20 mallocs. :(1289
23
1612
24
2016
25
2521
26
3152
27
3941
28
4927
29
6159
30
7699
31
9624
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100