Commit 404b6e3
Inline 1-use methods for performance/readability
I suggest this for a series of reasons:
1. Performance. Every function scope is expensive in PHP. This code
is executed hundreds of thousands of times. This adds up fast.
2. This allows us to merge two write() calls together.
3. Readabilty becomes better, I would argue. Names like "addbegin"
and "addend" were not really meaningful to begin with. Inlining them
allows to change the execution order slightly and group stuff together
that belongs together. Both $this->hplist and $this->numentries are
only needed much later in finish().
This patch alone makes an actual difference. For example, the
MessageIndexTest in the Translate extension improves from 1.7s to
1.4s on my machine.
Change-Id: I94ce310384a807b8ff177a5c80826d5e77f184b01 parent 54cad84 commit 404b6e3
1 file changed
+21
-33
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
76 | | - | |
77 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
78 | 96 | | |
79 | 97 | | |
80 | 98 | | |
| |||
114 | 132 | | |
115 | 133 | | |
116 | 134 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | 135 | | |
148 | 136 | | |
149 | 137 | | |
| |||
0 commit comments