@@ -125,10 +125,10 @@ func TestCityLots(t *testing.T) {
125125 message1 := fmt .Sprintf ("Events-per-second benchmark ran at %.0f events per second, below threshold of %.0f." ,
126126 perSecond , thresholdPerformance )
127127 message2 := `
128- It may be that re-running the benchmark test will address this, or it may be that you're running on a machine
129- that is slower than the one the software was developed on, in which case you might want to readjust the
130- "thresholdPerformance" constant. However, it may be that you made a change that reduced the throughput of the
131- library, which would be unacceptable.`
128+ It may be that re-running the benchmark test will address this, or it may be that you're running on a machine
129+ that is slower than the one the software was developed on, in which case you might want to readjust the
130+ "thresholdPerformance" constant. However, it may be that you made a change that reduced the throughput of the
131+ library, which would be unacceptable.`
132132 t .Errorf (message1 + message2 )
133133 }
134134
@@ -178,17 +178,7 @@ func TestMySoftwareHatesMe(t *testing.T) {
178178 t.Error("no match for EEE")
179179 }
180180}
181- */
182-
183-
184- func containsX (list []X , x X ) bool {
185- for _ , in := range list {
186- if in == x {
187- return true
188- }
189- }
190- return false
191- }
181+ */
192182
193183// exercise shellstyle matching a little, is much faster than TestCityLots because it's only working wth one field
194184func TestBigShellStyle (t * testing.T ) {
@@ -218,7 +208,7 @@ func TestBigShellStyle(t *testing.T) {
218208 `{"properties": {"STREET":[ {"shellstyle": "N*P*"} ] } }`: 927,
219209 `{"properties": {"STREET":[ {"shellstyle": "*E*E*E*"} ] } }`: 1212,
220210 }
221- */
211+ */
222212
223213 for letter := range wanted {
224214 pat := fmt .Sprintf (`{"properties": {"STREET":[ {"shellstyle": "%s*"} ] } }` , letter )
@@ -229,13 +219,13 @@ func TestBigShellStyle(t *testing.T) {
229219 }
230220
231221 /*
232- for funk := range funky {
233- err := m.AddPattern(funk, funk.(string))
234- if err != nil {
235- t.Errorf("err on %s: %s", funk, err.Error())
222+ for funk := range funky {
223+ err := m.AddPattern(funk, funk.(string))
224+ if err != nil {
225+ t.Errorf("err on %s: %s", funk, err.Error())
226+ }
236227 }
237- }
238- */
228+ */
239229 fmt .Println (matcherStats (m ))
240230
241231 lineCount := 0
@@ -271,20 +261,21 @@ func TestBigShellStyle(t *testing.T) {
271261 }
272262 }
273263 /*
274- for k, wc := range funky {
275- if lCounts[k] != wc {
276- t.Errorf("for %s wanted %d got %d", k, wc, lCounts[k])
264+ for k, wc := range funky {
265+ if lCounts[k] != wc {
266+ t.Errorf("for %s wanted %d got %d", k, wc, lCounts[k])
267+ }
277268 }
278- }
279-
280- */
269+
270+ */
281271}
282272
283273// TestPatternAddition adds a whole lot of string-only rules as fast as possible The profiler says that the
284274// performance is totally doinated by the garbage-collector thrashing, in particular it has to allocate
285275// ~220K smallTables. Tried https://blog.twitch.tv/en/2019/04/10/go-memory-ballast-how-i-learnt-to-stop-worrying-and-love-the-heap/
286276// but it doesn't seem to help.
287277// TODO: Find a way to allocate less tables.
278+ // TODO: Add shellstyle patterns
288279func TestPatternAddition (t * testing.T ) {
289280 w := worder {0 , readWWords (t )}
290281
@@ -312,7 +303,7 @@ func TestPatternAddition(t *testing.T) {
312303 }
313304 }
314305 runtime .ReadMemStats (& msAfter )
315- delta := 1.0 / 1000000.0 * float64 (msAfter .Alloc - msBefore .Alloc )
306+ delta := 1.0 / 1000000.0 * float64 (msAfter .Alloc - msBefore .Alloc )
316307 fmt .Printf ("before %d, after %d, delta %f\n " , msBefore .Alloc , msAfter .Alloc , delta )
317308 fmt .Println ("stats:" + matcherStats (m ))
318309 elapsed := float64 (time .Now ().Sub (before ).Milliseconds ())
0 commit comments