]> Cypherpunks.ru repositories - gostls13.git/blob - test/gcgort.go
cmd/compile/internal/inline: score call sites exposed by inlines
[gostls13.git] / test / gcgort.go
1 // run
2
3 // Copyright 2018 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
6
7 // Test independent goroutines modifying a comprehensive
8 // variety of vars during aggressive garbage collection.
9
10 // The point is to catch GC regressions like fixedbugs/issue22781.go
11
12 package main
13
14 import (
15         "errors"
16         "runtime"
17         "runtime/debug"
18         "sync"
19 )
20
21 const (
22         goroutines = 8
23         allocs     = 8
24         mods       = 8
25
26         length = 9
27 )
28
29 func main() {
30         debug.SetGCPercent(1)
31         var wg sync.WaitGroup
32         for i := 0; i < goroutines; i++ {
33                 for _, t := range types {
34                         err := t.valid()
35                         if err != nil {
36                                 panic(err)
37                         }
38                         wg.Add(1)
39                         go func(f modifier) {
40                                 var wg2 sync.WaitGroup
41                                 for j := 0; j < allocs; j++ {
42                                         wg2.Add(1)
43                                         go func() {
44                                                 f.t()
45                                                 wg2.Done()
46                                         }()
47                                         wg2.Add(1)
48                                         go func() {
49                                                 f.pointerT()
50                                                 wg2.Done()
51                                         }()
52                                         wg2.Add(1)
53                                         go func() {
54                                                 f.arrayT()
55                                                 wg2.Done()
56                                         }()
57                                         wg2.Add(1)
58                                         go func() {
59                                                 f.sliceT()
60                                                 wg2.Done()
61                                         }()
62                                         wg2.Add(1)
63                                         go func() {
64                                                 f.mapT()
65                                                 wg2.Done()
66                                         }()
67                                         wg2.Add(1)
68                                         go func() {
69                                                 f.mapPointerKeyT()
70                                                 wg2.Done()
71                                         }()
72                                         wg2.Add(1)
73                                         go func() {
74                                                 f.chanT()
75                                                 wg2.Done()
76                                         }()
77                                         wg2.Add(1)
78                                         go func() {
79                                                 f.interfaceT()
80                                                 wg2.Done()
81                                         }()
82                                 }
83                                 wg2.Wait()
84                                 wg.Done()
85                         }(t)
86                 }
87         }
88         wg.Wait()
89 }
90
91 type modifier struct {
92         name           string
93         t              func()
94         pointerT       func()
95         arrayT         func()
96         sliceT         func()
97         mapT           func()
98         mapPointerKeyT func()
99         chanT          func()
100         interfaceT     func()
101 }
102
103 func (a modifier) valid() error {
104         switch {
105         case a.name == "":
106                 return errors.New("modifier without name")
107         case a.t == nil:
108                 return errors.New(a.name + " missing t")
109         case a.pointerT == nil:
110                 return errors.New(a.name + " missing pointerT")
111         case a.arrayT == nil:
112                 return errors.New(a.name + " missing arrayT")
113         case a.sliceT == nil:
114                 return errors.New(a.name + " missing sliceT")
115         case a.mapT == nil:
116                 return errors.New(a.name + " missing mapT")
117         case a.mapPointerKeyT == nil:
118                 return errors.New(a.name + " missing mapPointerKeyT")
119         case a.chanT == nil:
120                 return errors.New(a.name + " missing chanT")
121         case a.interfaceT == nil:
122                 return errors.New(a.name + " missing interfaceT")
123         default:
124                 return nil
125         }
126 }
127
128 var types = []modifier{
129         modifier{
130                 name: "bool",
131                 t: func() {
132                         var a bool
133                         for i := 0; i < mods; i++ {
134                                 a = !a
135                                 runtime.Gosched()
136                         }
137                 },
138                 pointerT: func() {
139                         a := func() *bool { return new(bool) }()
140                         for i := 0; i < mods; i++ {
141                                 *a = !*a
142                                 runtime.Gosched()
143                         }
144                 },
145                 arrayT: func() {
146                         a := [length]bool{}
147                         for i := 0; i < mods; i++ {
148                                 for j := 0; j < len(a); j++ {
149                                         a[j] = !a[j]
150                                         runtime.Gosched()
151                                 }
152                         }
153                 },
154                 sliceT: func() {
155                         a := make([]bool, length)
156                         for i := 0; i < mods; i++ {
157                                 for j := 0; j < len(a); j++ {
158                                         a[j] = !a[j]
159                                         runtime.Gosched()
160                                 }
161                         }
162                 },
163                 mapT: func() {
164                         a := make(map[bool]bool)
165                         for i := 0; i < mods; i++ {
166                                 a[false] = !a[false]
167                                 a[true] = !a[true]
168                                 runtime.Gosched()
169                         }
170                 },
171                 mapPointerKeyT: func() {
172                         a := make(map[*bool]bool)
173                         for i := 0; i < length; i++ {
174                                 a[new(bool)] = false
175                                 runtime.Gosched()
176                         }
177                         for i := 0; i < mods; i++ {
178                                 for k, v := range a {
179                                         a[k] = !v
180                                         runtime.Gosched()
181                                 }
182                         }
183                 },
184                 chanT: func() {
185                         a := make(chan bool)
186                         for i := 0; i < mods; i++ {
187                                 go func() { a <- false }()
188                                 <-a
189                                 runtime.Gosched()
190                         }
191                 },
192                 interfaceT: func() {
193                         a := interface{}(bool(false))
194                         for i := 0; i < mods; i++ {
195                                 a = !a.(bool)
196                                 runtime.Gosched()
197                         }
198                 },
199         },
200         modifier{
201                 name: "uint8",
202                 t: func() {
203                         var u uint8
204                         for i := 0; i < mods; i++ {
205                                 u++
206                                 runtime.Gosched()
207                         }
208                 },
209                 pointerT: func() {
210                         a := func() *uint8 { return new(uint8) }()
211                         for i := 0; i < mods; i++ {
212                                 *a++
213                                 runtime.Gosched()
214                         }
215                 },
216                 arrayT: func() {
217                         a := [length]uint8{}
218                         for i := 0; i < mods; i++ {
219                                 for j := 0; j < len(a); j++ {
220                                         a[j]++
221                                         runtime.Gosched()
222                                 }
223                         }
224                 },
225                 sliceT: func() {
226                         a := make([]uint8, length)
227                         for i := 0; i < mods; i++ {
228                                 for j := 0; j < len(a); j++ {
229                                         a[j]++
230                                         runtime.Gosched()
231                                 }
232                         }
233                 },
234                 mapT: func() {
235                         a := make(map[uint8]uint8)
236                         for i := 0; i < length; i++ {
237                                 a[uint8(i)] = uint8(i)
238                                 runtime.Gosched()
239                         }
240                         for i := 0; i < mods; i++ {
241                                 for k, _ := range a {
242                                         a[k]++
243                                 }
244                                 runtime.Gosched()
245                         }
246                 },
247                 mapPointerKeyT: func() {
248                         a := make(map[*uint8]uint8)
249                         for i := 0; i < length; i++ {
250                                 a[new(uint8)] = uint8(i)
251                                 runtime.Gosched()
252                         }
253                         for i := 0; i < mods; i++ {
254                                 for k, _ := range a {
255                                         a[k]++
256                                         runtime.Gosched()
257                                 }
258                         }
259                 },
260                 chanT: func() {
261                         a := make(chan uint8)
262                         for i := 0; i < mods; i++ {
263                                 go func() { a <- uint8(i) }()
264                                 <-a
265                                 runtime.Gosched()
266                         }
267                 },
268                 interfaceT: func() {
269                         a := interface{}(uint8(0))
270                         for i := 0; i < mods; i++ {
271                                 a = a.(uint8) + 1
272                                 runtime.Gosched()
273                         }
274                 },
275         },
276         modifier{
277                 name: "uint16",
278                 t: func() {
279                         var u uint16
280                         for i := 0; i < mods; i++ {
281                                 u++
282                                 runtime.Gosched()
283                         }
284                 },
285                 pointerT: func() {
286                         a := func() *uint16 { return new(uint16) }()
287                         for i := 0; i < mods; i++ {
288                                 *a++
289                                 runtime.Gosched()
290                         }
291                 },
292                 arrayT: func() {
293                         a := [length]uint16{}
294                         for i := 0; i < mods; i++ {
295                                 for j := 0; j < len(a); j++ {
296                                         a[j]++
297                                         runtime.Gosched()
298                                 }
299                         }
300                 },
301                 sliceT: func() {
302                         a := make([]uint16, length)
303                         for i := 0; i < mods; i++ {
304                                 for j := 0; j < len(a); j++ {
305                                         a[j]++
306                                         runtime.Gosched()
307                                 }
308                         }
309                 },
310                 mapT: func() {
311                         a := make(map[uint16]uint16)
312                         for i := 0; i < length; i++ {
313                                 a[uint16(i)] = uint16(i)
314                                 runtime.Gosched()
315                         }
316                         for i := 0; i < mods; i++ {
317                                 for k, _ := range a {
318                                         a[k]++
319                                 }
320                                 runtime.Gosched()
321                         }
322                 },
323                 mapPointerKeyT: func() {
324                         a := make(map[*uint16]uint16)
325                         for i := 0; i < length; i++ {
326                                 a[new(uint16)] = uint16(i)
327                                 runtime.Gosched()
328                         }
329                         for i := 0; i < mods; i++ {
330                                 for k, _ := range a {
331                                         a[k]++
332                                         runtime.Gosched()
333                                 }
334                         }
335                 },
336                 chanT: func() {
337                         a := make(chan uint16)
338                         for i := 0; i < mods; i++ {
339                                 go func() { a <- uint16(i) }()
340                                 <-a
341                                 runtime.Gosched()
342                         }
343                 },
344                 interfaceT: func() {
345                         a := interface{}(uint16(0))
346                         for i := 0; i < mods; i++ {
347                                 a = a.(uint16) + 1
348                                 runtime.Gosched()
349                         }
350                 },
351         },
352         modifier{
353                 name: "uint32",
354                 t: func() {
355                         var u uint32
356                         for i := 0; i < mods; i++ {
357                                 u++
358                                 runtime.Gosched()
359                         }
360                 },
361                 pointerT: func() {
362                         a := func() *uint32 { return new(uint32) }()
363                         for i := 0; i < mods; i++ {
364                                 *a++
365                                 runtime.Gosched()
366                         }
367                 },
368                 arrayT: func() {
369                         a := [length]uint32{}
370                         for i := 0; i < mods; i++ {
371                                 for j := 0; j < len(a); j++ {
372                                         a[j]++
373                                         runtime.Gosched()
374                                 }
375                         }
376                 },
377                 sliceT: func() {
378                         a := make([]uint32, length)
379                         for i := 0; i < mods; i++ {
380                                 for j := 0; j < len(a); j++ {
381                                         a[j]++
382                                         runtime.Gosched()
383                                 }
384                         }
385                 },
386                 mapT: func() {
387                         a := make(map[uint32]uint32)
388                         for i := 0; i < length; i++ {
389                                 a[uint32(i)] = uint32(i)
390                                 runtime.Gosched()
391                         }
392                         for i := 0; i < mods; i++ {
393                                 for k, _ := range a {
394                                         a[k]++
395                                 }
396                                 runtime.Gosched()
397                         }
398                 },
399                 mapPointerKeyT: func() {
400                         a := make(map[*uint32]uint32)
401                         for i := 0; i < length; i++ {
402                                 a[new(uint32)] = uint32(i)
403                                 runtime.Gosched()
404                         }
405                         for i := 0; i < mods; i++ {
406                                 for k, _ := range a {
407                                         a[k]++
408                                         runtime.Gosched()
409                                 }
410                         }
411                 },
412                 chanT: func() {
413                         a := make(chan uint32)
414                         for i := 0; i < mods; i++ {
415                                 go func() { a <- uint32(i) }()
416                                 <-a
417                                 runtime.Gosched()
418                         }
419                 },
420                 interfaceT: func() {
421                         a := interface{}(uint32(0))
422                         for i := 0; i < mods; i++ {
423                                 a = a.(uint32) + 1
424                                 runtime.Gosched()
425                         }
426                 },
427         },
428         modifier{
429                 name: "uint64",
430                 t: func() {
431                         var u uint64
432                         for i := 0; i < mods; i++ {
433                                 u++
434                                 runtime.Gosched()
435                         }
436                 },
437                 pointerT: func() {
438                         a := func() *uint64 { return new(uint64) }()
439                         for i := 0; i < mods; i++ {
440                                 *a++
441                                 runtime.Gosched()
442                         }
443                 },
444                 arrayT: func() {
445                         a := [length]uint64{}
446                         for i := 0; i < mods; i++ {
447                                 for j := 0; j < len(a); j++ {
448                                         a[j]++
449                                         runtime.Gosched()
450                                 }
451                         }
452                 },
453                 sliceT: func() {
454                         a := make([]uint64, length)
455                         for i := 0; i < mods; i++ {
456                                 for j := 0; j < len(a); j++ {
457                                         a[j]++
458                                         runtime.Gosched()
459                                 }
460                         }
461                 },
462                 mapT: func() {
463                         a := make(map[uint64]uint64)
464                         for i := 0; i < length; i++ {
465                                 a[uint64(i)] = uint64(i)
466                                 runtime.Gosched()
467                         }
468                         for i := 0; i < mods; i++ {
469                                 for k, _ := range a {
470                                         a[k]++
471                                 }
472                                 runtime.Gosched()
473                         }
474                 },
475                 mapPointerKeyT: func() {
476                         a := make(map[*uint64]uint64)
477                         for i := 0; i < length; i++ {
478                                 a[new(uint64)] = uint64(i)
479                                 runtime.Gosched()
480                         }
481                         for i := 0; i < mods; i++ {
482                                 for k, _ := range a {
483                                         a[k]++
484                                         runtime.Gosched()
485                                 }
486                         }
487                 },
488                 chanT: func() {
489                         a := make(chan uint64)
490                         for i := 0; i < mods; i++ {
491                                 go func() { a <- uint64(i) }()
492                                 <-a
493                                 runtime.Gosched()
494                         }
495                 },
496                 interfaceT: func() {
497                         a := interface{}(uint64(0))
498                         for i := 0; i < mods; i++ {
499                                 a = a.(uint64) + 1
500                                 runtime.Gosched()
501                         }
502                 },
503         },
504         modifier{
505                 name: "int8",
506                 t: func() {
507                         var u int8
508                         for i := 0; i < mods; i++ {
509                                 u++
510                                 runtime.Gosched()
511                         }
512                 },
513                 pointerT: func() {
514                         a := func() *int8 { return new(int8) }()
515                         for i := 0; i < mods; i++ {
516                                 *a++
517                                 runtime.Gosched()
518                         }
519                 },
520                 arrayT: func() {
521                         a := [length]int8{}
522                         for i := 0; i < mods; i++ {
523                                 for j := 0; j < len(a); j++ {
524                                         a[j]++
525                                         runtime.Gosched()
526                                 }
527                         }
528                 },
529                 sliceT: func() {
530                         a := make([]int8, length)
531                         for i := 0; i < mods; i++ {
532                                 for j := 0; j < len(a); j++ {
533                                         a[j]++
534                                         runtime.Gosched()
535                                 }
536                         }
537                 },
538                 mapT: func() {
539                         a := make(map[int8]int8)
540                         for i := 0; i < length; i++ {
541                                 a[int8(i)] = int8(i)
542                                 runtime.Gosched()
543                         }
544                         for i := 0; i < mods; i++ {
545                                 for k, _ := range a {
546                                         a[k]++
547                                 }
548                                 runtime.Gosched()
549                         }
550                 },
551                 mapPointerKeyT: func() {
552                         a := make(map[*int8]int8)
553                         for i := 0; i < length; i++ {
554                                 a[new(int8)] = int8(i)
555                                 runtime.Gosched()
556                         }
557                         for i := 0; i < mods; i++ {
558                                 for k, _ := range a {
559                                         a[k]++
560                                         runtime.Gosched()
561                                 }
562                         }
563                 },
564                 chanT: func() {
565                         a := make(chan int8)
566                         for i := 0; i < mods; i++ {
567                                 go func() { a <- int8(i) }()
568                                 <-a
569                                 runtime.Gosched()
570                         }
571                 },
572                 interfaceT: func() {
573                         a := interface{}(int8(0))
574                         for i := 0; i < mods; i++ {
575                                 a = a.(int8) + 1
576                                 runtime.Gosched()
577                         }
578                 },
579         },
580         modifier{
581                 name: "int16",
582                 t: func() {
583                         var u int16
584                         for i := 0; i < mods; i++ {
585                                 u++
586                                 runtime.Gosched()
587                         }
588                 },
589                 pointerT: func() {
590                         a := func() *int16 { return new(int16) }()
591                         for i := 0; i < mods; i++ {
592                                 *a++
593                                 runtime.Gosched()
594                         }
595                 },
596                 arrayT: func() {
597                         a := [length]int16{}
598                         for i := 0; i < mods; i++ {
599                                 for j := 0; j < len(a); j++ {
600                                         a[j]++
601                                         runtime.Gosched()
602                                 }
603                         }
604                 },
605                 sliceT: func() {
606                         a := make([]int16, length)
607                         for i := 0; i < mods; i++ {
608                                 for j := 0; j < len(a); j++ {
609                                         a[j]++
610                                         runtime.Gosched()
611                                 }
612                         }
613                 },
614                 mapT: func() {
615                         a := make(map[int16]int16)
616                         for i := 0; i < length; i++ {
617                                 a[int16(i)] = int16(i)
618                                 runtime.Gosched()
619                         }
620                         for i := 0; i < mods; i++ {
621                                 for k, _ := range a {
622                                         a[k]++
623                                 }
624                                 runtime.Gosched()
625                         }
626                 },
627                 mapPointerKeyT: func() {
628                         a := make(map[*int16]int16)
629                         for i := 0; i < length; i++ {
630                                 a[new(int16)] = int16(i)
631                                 runtime.Gosched()
632                         }
633                         for i := 0; i < mods; i++ {
634                                 for k, _ := range a {
635                                         a[k]++
636                                         runtime.Gosched()
637                                 }
638                         }
639                 },
640                 chanT: func() {
641                         a := make(chan int16)
642                         for i := 0; i < mods; i++ {
643                                 go func() { a <- int16(i) }()
644                                 <-a
645                                 runtime.Gosched()
646                         }
647                 },
648                 interfaceT: func() {
649                         a := interface{}(int16(0))
650                         for i := 0; i < mods; i++ {
651                                 a = a.(int16) + 1
652                                 runtime.Gosched()
653                         }
654                 },
655         },
656         modifier{
657                 name: "int32",
658                 t: func() {
659                         var u int32
660                         for i := 0; i < mods; i++ {
661                                 u++
662                                 runtime.Gosched()
663                         }
664                 },
665                 pointerT: func() {
666                         a := func() *int32 { return new(int32) }()
667                         for i := 0; i < mods; i++ {
668                                 *a++
669                                 runtime.Gosched()
670                         }
671                 },
672                 arrayT: func() {
673                         a := [length]int32{}
674                         for i := 0; i < mods; i++ {
675                                 for j := 0; j < len(a); j++ {
676                                         a[j]++
677                                         runtime.Gosched()
678                                 }
679                         }
680                 },
681                 sliceT: func() {
682                         a := make([]int32, length)
683                         for i := 0; i < mods; i++ {
684                                 for j := 0; j < len(a); j++ {
685                                         a[j]++
686                                         runtime.Gosched()
687                                 }
688                         }
689                 },
690                 mapT: func() {
691                         a := make(map[int32]int32)
692                         for i := 0; i < length; i++ {
693                                 a[int32(i)] = int32(i)
694                                 runtime.Gosched()
695                         }
696                         for i := 0; i < mods; i++ {
697                                 for k, _ := range a {
698                                         a[k]++
699                                 }
700                                 runtime.Gosched()
701                         }
702                 },
703                 mapPointerKeyT: func() {
704                         a := make(map[*int32]int32)
705                         for i := 0; i < length; i++ {
706                                 a[new(int32)] = int32(i)
707                                 runtime.Gosched()
708                         }
709                         for i := 0; i < mods; i++ {
710                                 for k, _ := range a {
711                                         a[k]++
712                                         runtime.Gosched()
713                                 }
714                         }
715                 },
716                 chanT: func() {
717                         a := make(chan int32)
718                         for i := 0; i < mods; i++ {
719                                 go func() { a <- int32(i) }()
720                                 <-a
721                                 runtime.Gosched()
722                         }
723                 },
724                 interfaceT: func() {
725                         a := interface{}(int32(0))
726                         for i := 0; i < mods; i++ {
727                                 a = a.(int32) + 1
728                                 runtime.Gosched()
729                         }
730                 },
731         },
732         modifier{
733                 name: "int64",
734                 t: func() {
735                         var u int64
736                         for i := 0; i < mods; i++ {
737                                 u++
738                                 runtime.Gosched()
739                         }
740                 },
741                 pointerT: func() {
742                         a := func() *int64 { return new(int64) }()
743                         for i := 0; i < mods; i++ {
744                                 *a++
745                                 runtime.Gosched()
746                         }
747                 },
748                 arrayT: func() {
749                         a := [length]int64{}
750                         for i := 0; i < mods; i++ {
751                                 for j := 0; j < len(a); j++ {
752                                         a[j]++
753                                         runtime.Gosched()
754                                 }
755                         }
756                 },
757                 sliceT: func() {
758                         a := make([]int64, length)
759                         for i := 0; i < mods; i++ {
760                                 for j := 0; j < len(a); j++ {
761                                         a[j]++
762                                         runtime.Gosched()
763                                 }
764                         }
765                 },
766                 mapT: func() {
767                         a := make(map[int64]int64)
768                         for i := 0; i < length; i++ {
769                                 a[int64(i)] = int64(i)
770                                 runtime.Gosched()
771                         }
772                         for i := 0; i < mods; i++ {
773                                 for k, _ := range a {
774                                         a[k]++
775                                 }
776                                 runtime.Gosched()
777                         }
778                 },
779                 mapPointerKeyT: func() {
780                         a := make(map[*int64]int64)
781                         for i := 0; i < length; i++ {
782                                 a[new(int64)] = int64(i)
783                                 runtime.Gosched()
784                         }
785                         for i := 0; i < mods; i++ {
786                                 for k, _ := range a {
787                                         a[k]++
788                                         runtime.Gosched()
789                                 }
790                         }
791                 },
792                 chanT: func() {
793                         a := make(chan int64)
794                         for i := 0; i < mods; i++ {
795                                 go func() { a <- int64(i) }()
796                                 <-a
797                                 runtime.Gosched()
798                         }
799                 },
800                 interfaceT: func() {
801                         a := interface{}(int64(0))
802                         for i := 0; i < mods; i++ {
803                                 a = a.(int64) + 1
804                                 runtime.Gosched()
805                         }
806                 },
807         },
808         modifier{
809                 name: "float32",
810                 t: func() {
811                         u := float32(1.01)
812                         for i := 0; i < mods; i++ {
813                                 u *= 1.01
814                                 runtime.Gosched()
815                         }
816                 },
817                 pointerT: func() {
818                         a := func() *float32 { return new(float32) }()
819                         *a = 1.01
820                         for i := 0; i < mods; i++ {
821                                 *a *= 1.01
822                                 runtime.Gosched()
823                         }
824                 },
825                 arrayT: func() {
826                         a := [length]float32{}
827                         for i := 0; i < length; i++ {
828                                 a[i] = float32(1.01)
829                                 runtime.Gosched()
830                         }
831                         for i := 0; i < mods; i++ {
832                                 for j := 0; j < len(a); j++ {
833                                         a[j] *= 1.01
834                                         runtime.Gosched()
835                                 }
836                         }
837                 },
838                 sliceT: func() {
839                         a := make([]float32, length)
840                         for i := 0; i < length; i++ {
841                                 a[i] = float32(1.01)
842                                 runtime.Gosched()
843                         }
844                         for i := 0; i < mods; i++ {
845                                 for j := 0; j < len(a); j++ {
846                                         a[j] *= 1.01
847                                         runtime.Gosched()
848                                 }
849                         }
850                 },
851                 mapT: func() {
852                         a := make(map[float32]float32)
853                         for i := 0; i < length; i++ {
854                                 a[float32(i)] = float32(i) + 0.01
855                                 runtime.Gosched()
856                         }
857                         for i := 0; i < mods; i++ {
858                                 for k, _ := range a {
859                                         a[k] *= 1.01
860                                 }
861                                 runtime.Gosched()
862                         }
863                 },
864                 mapPointerKeyT: func() {
865                         a := make(map[*float32]float32)
866                         for i := 0; i < length; i++ {
867                                 a[new(float32)] = float32(i) + 0.01
868                                 runtime.Gosched()
869                         }
870                         for i := 0; i < mods; i++ {
871                                 for k, _ := range a {
872                                         a[k] *= 1.01
873                                         runtime.Gosched()
874                                 }
875                         }
876                 },
877                 chanT: func() {
878                         a := make(chan float32)
879                         for i := 0; i < mods; i++ {
880                                 go func() { a <- float32(i) }()
881                                 <-a
882                                 runtime.Gosched()
883                         }
884                 },
885                 interfaceT: func() {
886                         a := interface{}(float32(0))
887                         for i := 0; i < mods; i++ {
888                                 a = a.(float32) * 1.01
889                                 runtime.Gosched()
890                         }
891                 },
892         },
893         modifier{
894                 name: "float64",
895                 t: func() {
896                         u := float64(1.01)
897                         for i := 0; i < mods; i++ {
898                                 u *= 1.01
899                                 runtime.Gosched()
900                         }
901                 },
902                 pointerT: func() {
903                         a := func() *float64 { return new(float64) }()
904                         *a = 1.01
905                         for i := 0; i < mods; i++ {
906                                 *a *= 1.01
907                                 runtime.Gosched()
908                         }
909                 },
910                 arrayT: func() {
911                         a := [length]float64{}
912                         for i := 0; i < length; i++ {
913                                 a[i] = float64(1.01)
914                                 runtime.Gosched()
915                         }
916                         for i := 0; i < mods; i++ {
917                                 for j := 0; j < len(a); j++ {
918                                         a[j] *= 1.01
919                                         runtime.Gosched()
920                                 }
921                         }
922                 },
923                 sliceT: func() {
924                         a := make([]float64, length)
925                         for i := 0; i < length; i++ {
926                                 a[i] = float64(1.01)
927                                 runtime.Gosched()
928                         }
929                         for i := 0; i < mods; i++ {
930                                 for j := 0; j < len(a); j++ {
931                                         a[j] *= 1.01
932                                         runtime.Gosched()
933                                 }
934                         }
935                 },
936                 mapT: func() {
937                         a := make(map[float64]float64)
938                         for i := 0; i < length; i++ {
939                                 a[float64(i)] = float64(i) + 0.01
940                                 runtime.Gosched()
941                         }
942                         for i := 0; i < mods; i++ {
943                                 for k, _ := range a {
944                                         a[k] *= 1.01
945                                 }
946                                 runtime.Gosched()
947                         }
948                 },
949                 mapPointerKeyT: func() {
950                         a := make(map[*float64]float64)
951                         for i := 0; i < length; i++ {
952                                 a[new(float64)] = float64(i) + 0.01
953                                 runtime.Gosched()
954                         }
955                         for i := 0; i < mods; i++ {
956                                 for k, _ := range a {
957                                         a[k] *= 1.01
958                                         runtime.Gosched()
959                                 }
960                         }
961                 },
962                 chanT: func() {
963                         a := make(chan float64)
964                         for i := 0; i < mods; i++ {
965                                 go func() { a <- float64(i) }()
966                                 <-a
967                                 runtime.Gosched()
968                         }
969                 },
970                 interfaceT: func() {
971                         a := interface{}(float64(0))
972                         for i := 0; i < mods; i++ {
973                                 a = a.(float64) * 1.01
974                                 runtime.Gosched()
975                         }
976                 },
977         },
978         modifier{
979                 name: "complex64",
980                 t: func() {
981                         c := complex64(complex(float32(1.01), float32(1.01)))
982                         for i := 0; i < mods; i++ {
983                                 c = complex(real(c)*1.01, imag(c)*1.01)
984                                 runtime.Gosched()
985                         }
986                 },
987                 pointerT: func() {
988                         a := func() *complex64 { return new(complex64) }()
989                         *a = complex64(complex(float32(1.01), float32(1.01)))
990                         for i := 0; i < mods; i++ {
991                                 *a *= complex(real(*a)*1.01, imag(*a)*1.01)
992                                 runtime.Gosched()
993                         }
994                 },
995                 arrayT: func() {
996                         a := [length]complex64{}
997                         for i := 0; i < length; i++ {
998                                 a[i] = complex64(complex(float32(1.01), float32(1.01)))
999                                 runtime.Gosched()
1000                         }
1001                         for i := 0; i < mods; i++ {
1002                                 for j := 0; j < len(a); j++ {
1003                                         a[j] *= complex(real(a[j])*1.01, imag(a[j])*1.01)
1004                                         runtime.Gosched()
1005                                 }
1006                         }
1007                 },
1008                 sliceT: func() {
1009                         a := make([]complex64, length)
1010                         for i := 0; i < length; i++ {
1011                                 a[i] = complex64(complex(float32(1.01), float32(1.01)))
1012                                 runtime.Gosched()
1013                         }
1014                         for i := 0; i < mods; i++ {
1015                                 for j := 0; j < len(a); j++ {
1016                                         a[j] *= complex(real(a[j])*1.01, imag(a[j])*1.01)
1017                                         runtime.Gosched()
1018                                 }
1019                         }
1020                 },
1021                 mapT: func() {
1022                         a := make(map[complex64]complex64)
1023                         for i := 0; i < length; i++ {
1024                                 a[complex64(complex(float32(i), float32(i)))] = complex64(complex(float32(i), float32(i))) + 0.01
1025                                 runtime.Gosched()
1026                         }
1027                         for i := 0; i < mods; i++ {
1028                                 for k, _ := range a {
1029                                         a[k] *= complex(real(a[k])*1.01, imag(a[k])*1.01)
1030                                 }
1031                                 runtime.Gosched()
1032                         }
1033                 },
1034                 mapPointerKeyT: func() {
1035                         a := make(map[*complex64]complex64)
1036                         for i := 0; i < length; i++ {
1037                                 a[new(complex64)] = complex64(complex(float32(i), float32(i))) + 0.01
1038                                 runtime.Gosched()
1039                         }
1040                         for i := 0; i < mods; i++ {
1041                                 for k, _ := range a {
1042                                         a[k] *= complex(real(a[k])*1.01, imag(a[k])*1.01)
1043                                         runtime.Gosched()
1044                                 }
1045                         }
1046                 },
1047                 chanT: func() {
1048                         a := make(chan complex64)
1049                         for i := 0; i < mods; i++ {
1050                                 go func() { a <- complex64(complex(float32(i), float32(i))) }()
1051                                 <-a
1052                                 runtime.Gosched()
1053                         }
1054                 },
1055                 interfaceT: func() {
1056                         a := interface{}(complex64(complex(float32(1.01), float32(1.01))))
1057                         for i := 0; i < mods; i++ {
1058                                 a = a.(complex64) * complex(real(a.(complex64))*1.01, imag(a.(complex64))*1.01)
1059                                 runtime.Gosched()
1060                         }
1061                 },
1062         },
1063         modifier{
1064                 name: "complex128",
1065                 t: func() {
1066                         c := complex128(complex(float64(1.01), float64(1.01)))
1067                         for i := 0; i < mods; i++ {
1068                                 c = complex(real(c)*1.01, imag(c)*1.01)
1069                                 runtime.Gosched()
1070                         }
1071                 },
1072                 pointerT: func() {
1073                         a := func() *complex128 { return new(complex128) }()
1074                         *a = complex128(complex(float64(1.01), float64(1.01)))
1075                         for i := 0; i < mods; i++ {
1076                                 *a *= complex(real(*a)*1.01, imag(*a)*1.01)
1077                                 runtime.Gosched()
1078                         }
1079                 },
1080                 arrayT: func() {
1081                         a := [length]complex128{}
1082                         for i := 0; i < length; i++ {
1083                                 a[i] = complex128(complex(float64(1.01), float64(1.01)))
1084                                 runtime.Gosched()
1085                         }
1086                         for i := 0; i < mods; i++ {
1087                                 for j := 0; j < len(a); j++ {
1088                                         a[j] *= complex(real(a[j])*1.01, imag(a[j])*1.01)
1089                                         runtime.Gosched()
1090                                 }
1091                         }
1092                 },
1093                 sliceT: func() {
1094                         a := make([]complex128, length)
1095                         for i := 0; i < length; i++ {
1096                                 a[i] = complex128(complex(float64(1.01), float64(1.01)))
1097                                 runtime.Gosched()
1098                         }
1099                         for i := 0; i < mods; i++ {
1100                                 for j := 0; j < len(a); j++ {
1101                                         a[j] *= complex(real(a[j])*1.01, imag(a[j])*1.01)
1102                                         runtime.Gosched()
1103                                 }
1104                         }
1105                 },
1106                 mapT: func() {
1107                         a := make(map[complex128]complex128)
1108                         for i := 0; i < length; i++ {
1109                                 a[complex128(complex(float64(i), float64(i)))] = complex128(complex(float64(i), float64(i))) + 0.01
1110                                 runtime.Gosched()
1111                         }
1112                         for i := 0; i < mods; i++ {
1113                                 for k, _ := range a {
1114                                         a[k] *= complex(real(a[k])*1.01, imag(a[k])*1.01)
1115                                 }
1116                                 runtime.Gosched()
1117                         }
1118                 },
1119                 mapPointerKeyT: func() {
1120                         a := make(map[*complex128]complex128)
1121                         for i := 0; i < length; i++ {
1122                                 a[new(complex128)] = complex128(complex(float64(i), float64(i))) + 0.01
1123                                 runtime.Gosched()
1124                         }
1125                         for i := 0; i < mods; i++ {
1126                                 for k, _ := range a {
1127                                         a[k] *= complex(real(a[k])*1.01, imag(a[k])*1.01)
1128                                         runtime.Gosched()
1129                                 }
1130                         }
1131                 },
1132                 chanT: func() {
1133                         a := make(chan complex128)
1134                         for i := 0; i < mods; i++ {
1135                                 go func() { a <- complex128(complex(float64(i), float64(i))) }()
1136                                 <-a
1137                                 runtime.Gosched()
1138                         }
1139                 },
1140                 interfaceT: func() {
1141                         a := interface{}(complex128(complex(float64(1.01), float64(1.01))))
1142                         for i := 0; i < mods; i++ {
1143                                 a = a.(complex128) * complex(real(a.(complex128))*1.01, imag(a.(complex128))*1.01)
1144                                 runtime.Gosched()
1145                         }
1146                 },
1147         },
1148         modifier{
1149                 name: "byte",
1150                 t: func() {
1151                         var a byte
1152                         for i := 0; i < mods; i++ {
1153                                 a++
1154                                 runtime.Gosched()
1155                         }
1156                 },
1157                 pointerT: func() {
1158                         a := func() *byte { return new(byte) }()
1159                         for i := 0; i < mods; i++ {
1160                                 *a++
1161                                 runtime.Gosched()
1162                         }
1163                 },
1164                 arrayT: func() {
1165                         a := [length]byte{}
1166                         for i := 0; i < mods; i++ {
1167                                 for j := 0; j < len(a); j++ {
1168                                         a[j]++
1169                                         runtime.Gosched()
1170                                 }
1171                         }
1172                 },
1173                 sliceT: func() {
1174                         a := make([]byte, length)
1175                         for i := 0; i < mods; i++ {
1176                                 for j := 0; j < len(a); j++ {
1177                                         a[j]++
1178                                         runtime.Gosched()
1179                                 }
1180                         }
1181                 },
1182                 mapT: func() {
1183                         a := make(map[byte]byte)
1184                         for i := 0; i < length; i++ {
1185                                 a[byte(i)] = byte(i)
1186                                 runtime.Gosched()
1187                         }
1188                         for i := 0; i < mods; i++ {
1189                                 for k, _ := range a {
1190                                         a[k]++
1191                                 }
1192                                 runtime.Gosched()
1193                         }
1194                 },
1195                 mapPointerKeyT: func() {
1196                         a := make(map[*byte]byte)
1197                         for i := 0; i < length; i++ {
1198                                 a[new(byte)] = byte(i)
1199                                 runtime.Gosched()
1200                         }
1201                         for i := 0; i < mods; i++ {
1202                                 for k, _ := range a {
1203                                         a[k]++
1204                                         runtime.Gosched()
1205                                 }
1206                         }
1207                 },
1208                 chanT: func() {
1209                         a := make(chan byte)
1210                         for i := 0; i < mods; i++ {
1211                                 go func() { a <- byte(i) }()
1212                                 <-a
1213                                 runtime.Gosched()
1214                         }
1215                 },
1216                 interfaceT: func() {
1217                         a := interface{}(byte(0))
1218                         for i := 0; i < mods; i++ {
1219                                 a = a.(byte) + 1
1220                                 runtime.Gosched()
1221                         }
1222                 },
1223         },
1224         modifier{
1225                 name: "rune",
1226                 t: func() {
1227                         var a rune
1228                         for i := 0; i < mods; i++ {
1229                                 a++
1230                                 runtime.Gosched()
1231                         }
1232                 },
1233                 pointerT: func() {
1234                         a := func() *rune { return new(rune) }()
1235                         for i := 0; i < mods; i++ {
1236                                 *a++
1237                                 runtime.Gosched()
1238                         }
1239                 },
1240                 arrayT: func() {
1241                         a := [length]rune{}
1242                         for i := 0; i < mods; i++ {
1243                                 for j := 0; j < len(a); j++ {
1244                                         a[j]++
1245                                         runtime.Gosched()
1246                                 }
1247                         }
1248                 },
1249                 sliceT: func() {
1250                         a := make([]rune, length)
1251                         for i := 0; i < mods; i++ {
1252                                 for j := 0; j < len(a); j++ {
1253                                         a[j]++
1254                                         runtime.Gosched()
1255                                 }
1256                         }
1257                 },
1258                 mapT: func() {
1259                         a := make(map[rune]rune)
1260                         for i := 0; i < length; i++ {
1261                                 a[rune(i)] = rune(i)
1262                                 runtime.Gosched()
1263                         }
1264                         for i := 0; i < mods; i++ {
1265                                 for k, _ := range a {
1266                                         a[k]++
1267                                 }
1268                                 runtime.Gosched()
1269                         }
1270                 },
1271                 mapPointerKeyT: func() {
1272                         a := make(map[*rune]rune)
1273                         for i := 0; i < length; i++ {
1274                                 a[new(rune)] = rune(i)
1275                                 runtime.Gosched()
1276                         }
1277                         for i := 0; i < mods; i++ {
1278                                 for k, _ := range a {
1279                                         a[k]++
1280                                         runtime.Gosched()
1281                                 }
1282                         }
1283                 },
1284                 chanT: func() {
1285                         a := make(chan rune)
1286                         for i := 0; i < mods; i++ {
1287                                 go func() { a <- rune(i) }()
1288                                 <-a
1289                                 runtime.Gosched()
1290                         }
1291                 },
1292                 interfaceT: func() {
1293                         a := interface{}(rune(0))
1294                         for i := 0; i < mods; i++ {
1295                                 a = a.(rune) + 1
1296                                 runtime.Gosched()
1297                         }
1298                 },
1299         },
1300         modifier{
1301                 name: "uint",
1302                 t: func() {
1303                         var a uint
1304                         for i := 0; i < mods; i++ {
1305                                 a++
1306                                 runtime.Gosched()
1307                         }
1308                 },
1309                 pointerT: func() {
1310                         a := func() *uint { return new(uint) }()
1311                         for i := 0; i < mods; i++ {
1312                                 *a++
1313                                 runtime.Gosched()
1314                         }
1315                 },
1316                 arrayT: func() {
1317                         a := [length]uint{}
1318                         for i := 0; i < mods; i++ {
1319                                 for j := 0; j < len(a); j++ {
1320                                         a[j]++
1321                                         runtime.Gosched()
1322                                 }
1323                         }
1324                 },
1325                 sliceT: func() {
1326                         a := make([]uint, length)
1327                         for i := 0; i < mods; i++ {
1328                                 for j := 0; j < len(a); j++ {
1329                                         a[j]++
1330                                         runtime.Gosched()
1331                                 }
1332                         }
1333                 },
1334                 mapT: func() {
1335                         a := make(map[uint]uint)
1336                         for i := 0; i < length; i++ {
1337                                 a[uint(i)] = uint(i)
1338                                 runtime.Gosched()
1339                         }
1340                         for i := 0; i < mods; i++ {
1341                                 for k, _ := range a {
1342                                         a[k]++
1343                                 }
1344                                 runtime.Gosched()
1345                         }
1346                 },
1347                 mapPointerKeyT: func() {
1348                         a := make(map[*uint]uint)
1349                         for i := 0; i < length; i++ {
1350                                 a[new(uint)] = uint(i)
1351                                 runtime.Gosched()
1352                         }
1353                         for i := 0; i < mods; i++ {
1354                                 for k, _ := range a {
1355                                         a[k]++
1356                                         runtime.Gosched()
1357                                 }
1358                         }
1359                 },
1360                 chanT: func() {
1361                         a := make(chan uint)
1362                         for i := 0; i < mods; i++ {
1363                                 go func() { a <- uint(i) }()
1364                                 <-a
1365                                 runtime.Gosched()
1366                         }
1367                 },
1368                 interfaceT: func() {
1369                         a := interface{}(uint(0))
1370                         for i := 0; i < mods; i++ {
1371                                 a = a.(uint) + 1
1372                                 runtime.Gosched()
1373                         }
1374                 },
1375         },
1376         modifier{
1377                 name: "int",
1378                 t: func() {
1379                         var a int
1380                         for i := 0; i < mods; i++ {
1381                                 a++
1382                                 runtime.Gosched()
1383                         }
1384                 },
1385                 pointerT: func() {
1386                         a := func() *int { return new(int) }()
1387                         for i := 0; i < mods; i++ {
1388                                 *a++
1389                                 runtime.Gosched()
1390                         }
1391                 },
1392                 arrayT: func() {
1393                         a := [length]int{}
1394                         for i := 0; i < mods; i++ {
1395                                 for j := 0; j < len(a); j++ {
1396                                         a[j]++
1397                                         runtime.Gosched()
1398                                 }
1399                         }
1400                 },
1401                 sliceT: func() {
1402                         a := make([]int, length)
1403                         for i := 0; i < mods; i++ {
1404                                 for j := 0; j < len(a); j++ {
1405                                         a[j]++
1406                                         runtime.Gosched()
1407                                 }
1408                         }
1409                 },
1410                 mapT: func() {
1411                         a := make(map[int]int)
1412                         for i := 0; i < length; i++ {
1413                                 a[int(i)] = int(i)
1414                                 runtime.Gosched()
1415                         }
1416                         for i := 0; i < mods; i++ {
1417                                 for k, _ := range a {
1418                                         a[k]++
1419                                 }
1420                                 runtime.Gosched()
1421                         }
1422                 },
1423                 mapPointerKeyT: func() {
1424                         a := make(map[*int]int)
1425                         for i := 0; i < length; i++ {
1426                                 a[new(int)] = int(i)
1427                                 runtime.Gosched()
1428                         }
1429                         for i := 0; i < mods; i++ {
1430                                 for k, _ := range a {
1431                                         a[k]++
1432                                         runtime.Gosched()
1433                                 }
1434                         }
1435                 },
1436                 chanT: func() {
1437                         a := make(chan int)
1438                         for i := 0; i < mods; i++ {
1439                                 go func() { a <- int(i) }()
1440                                 <-a
1441                                 runtime.Gosched()
1442                         }
1443                 },
1444                 interfaceT: func() {
1445                         a := interface{}(int(0))
1446                         for i := 0; i < mods; i++ {
1447                                 a = a.(int) + 1
1448                                 runtime.Gosched()
1449                         }
1450                 },
1451         },
1452         modifier{
1453                 name: "uintptr",
1454                 t: func() {
1455                         var a uintptr
1456                         for i := 0; i < mods; i++ {
1457                                 a++
1458                                 runtime.Gosched()
1459                         }
1460                 },
1461                 pointerT: func() {
1462                         a := func() *uintptr { return new(uintptr) }()
1463                         for i := 0; i < mods; i++ {
1464                                 *a++
1465                                 runtime.Gosched()
1466                         }
1467                 },
1468                 arrayT: func() {
1469                         a := [length]uintptr{}
1470                         for i := 0; i < mods; i++ {
1471                                 for j := 0; j < len(a); j++ {
1472                                         a[j]++
1473                                         runtime.Gosched()
1474                                 }
1475                         }
1476                 },
1477                 sliceT: func() {
1478                         a := make([]uintptr, length)
1479                         for i := 0; i < mods; i++ {
1480                                 for j := 0; j < len(a); j++ {
1481                                         a[j]++
1482                                         runtime.Gosched()
1483                                 }
1484                         }
1485                 },
1486                 mapT: func() {
1487                         a := make(map[uintptr]uintptr)
1488                         for i := 0; i < length; i++ {
1489                                 a[uintptr(i)] = uintptr(i)
1490                                 runtime.Gosched()
1491                         }
1492                         for i := 0; i < mods; i++ {
1493                                 for k, _ := range a {
1494                                         a[k]++
1495                                 }
1496                                 runtime.Gosched()
1497                         }
1498                 },
1499                 mapPointerKeyT: func() {
1500                         a := make(map[*uintptr]uintptr)
1501                         for i := 0; i < length; i++ {
1502                                 a[new(uintptr)] = uintptr(i)
1503                                 runtime.Gosched()
1504                         }
1505                         for i := 0; i < mods; i++ {
1506                                 for k, _ := range a {
1507                                         a[k]++
1508                                         runtime.Gosched()
1509                                 }
1510                         }
1511                 },
1512                 chanT: func() {
1513                         a := make(chan uintptr)
1514                         for i := 0; i < mods; i++ {
1515                                 go func() { a <- uintptr(i) }()
1516                                 <-a
1517                                 runtime.Gosched()
1518                         }
1519                 },
1520                 interfaceT: func() {
1521                         a := interface{}(uintptr(0))
1522                         for i := 0; i < mods; i++ {
1523                                 a = a.(uintptr) + 1
1524                                 runtime.Gosched()
1525                         }
1526                 },
1527         },
1528         modifier{
1529                 name: "string",
1530                 t: func() {
1531                         var s string
1532                         f := func(a string) string { return a }
1533                         for i := 0; i < mods; i++ {
1534                                 s = str(i)
1535                                 s = f(s)
1536                         }
1537                 },
1538                 pointerT: func() {
1539                         a := func() *string { return new(string) }()
1540                         for i := 0; i < mods; i++ {
1541                                 *a = str(i)
1542                                 runtime.Gosched()
1543                         }
1544                 },
1545                 arrayT: func() {
1546                         a := [length]string{}
1547                         for i := 0; i < mods; i++ {
1548                                 for j := 0; j < len(a); j++ {
1549                                         a[j] = str(i)
1550                                         runtime.Gosched()
1551                                 }
1552                         }
1553                 },
1554                 sliceT: func() {
1555                         a := make([]string, length)
1556                         for i := 0; i < mods; i++ {
1557                                 for j := 0; j < len(a); j++ {
1558                                         a[j] = str(i)
1559                                         runtime.Gosched()
1560                                 }
1561                         }
1562                 },
1563                 mapT: func() {
1564                         a := make(map[string]string)
1565                         for i := 0; i < length; i++ {
1566                                 a[string(i)] = str(i)
1567                                 runtime.Gosched()
1568                         }
1569                         for i := 0; i < mods; i++ {
1570                                 for k, _ := range a {
1571                                         a[k] = str(i)
1572                                 }
1573                                 runtime.Gosched()
1574                         }
1575                 },
1576                 mapPointerKeyT: func() {
1577                         a := make(map[*string]string)
1578                         for i := 0; i < length; i++ {
1579                                 a[new(string)] = str(i)
1580                                 runtime.Gosched()
1581                         }
1582                         for i := 0; i < mods; i++ {
1583                                 for k, _ := range a {
1584                                         a[k] = str(i)
1585                                         runtime.Gosched()
1586                                 }
1587                         }
1588                 },
1589                 chanT: func() {
1590                         a := make(chan string)
1591                         for i := 0; i < mods; i++ {
1592                                 go func() { a <- str(i) }()
1593                                 <-a
1594                                 runtime.Gosched()
1595                         }
1596                 },
1597                 interfaceT: func() {
1598                         a := interface{}(str(0))
1599                         f := func(a string) string { return a }
1600                         for i := 0; i < mods; i++ {
1601                                 a = str(i)
1602                                 a = f(a.(string))
1603                                 runtime.Gosched()
1604                         }
1605                 },
1606         },
1607         modifier{
1608                 name: "structT",
1609                 t: func() {
1610                         s := newStructT()
1611                         for i := 0; i < mods; i++ {
1612                                 s.u8++
1613                                 s.u16++
1614                                 s.u32++
1615                                 s.u64++
1616                                 s.i8++
1617                                 s.i16++
1618                                 s.i32++
1619                                 s.i64++
1620                                 s.f32 *= 1.01
1621                                 s.f64 *= 1.01
1622                                 s.c64 = complex(real(s.c64)*1.01, imag(s.c64)*1.01)
1623                                 s.c128 = complex(real(s.c128)*1.01, imag(s.c128)*1.01)
1624                                 s.b++
1625                                 s.r++
1626                                 s.u++
1627                                 s.in++
1628                                 s.uip++
1629                                 s.s = str(i)
1630                                 runtime.Gosched()
1631                         }
1632                 },
1633                 pointerT: func() {
1634                         s := func() *structT {
1635                                 t := newStructT()
1636                                 return &t
1637                         }()
1638                         for i := 0; i < mods; i++ {
1639                                 s.u8++
1640                                 s.u16++
1641                                 s.u32++
1642                                 s.u64++
1643                                 s.i8++
1644                                 s.i16++
1645                                 s.i32++
1646                                 s.i64++
1647                                 s.f32 *= 1.01
1648                                 s.f64 *= 1.01
1649                                 s.c64 = complex(real(s.c64)*1.01, imag(s.c64)*1.01)
1650                                 s.c128 = complex(real(s.c128)*1.01, imag(s.c128)*1.01)
1651                                 s.b++
1652                                 s.r++
1653                                 s.u++
1654                                 s.in++
1655                                 s.uip++
1656                                 s.s = str(i)
1657                                 runtime.Gosched()
1658                         }
1659                 },
1660                 arrayT: func() {
1661                         a := [length]structT{}
1662                         for i := 0; i < len(a); i++ {
1663                                 a[i] = newStructT()
1664                         }
1665                         for i := 0; i < mods; i++ {
1666                                 for j := 0; j < len(a); j++ {
1667                                         a[j].u8++
1668                                         a[j].u16++
1669                                         a[j].u32++
1670                                         a[j].u64++
1671                                         a[j].i8++
1672                                         a[j].i16++
1673                                         a[j].i32++
1674                                         a[j].i64++
1675                                         a[j].f32 *= 1.01
1676                                         a[j].f64 *= 1.01
1677                                         a[j].c64 = complex(real(a[j].c64)*1.01, imag(a[j].c64)*1.01)
1678                                         a[j].c128 = complex(real(a[j].c128)*1.01, imag(a[j].c128)*1.01)
1679                                         a[j].b++
1680                                         a[j].r++
1681                                         a[j].u++
1682                                         a[j].in++
1683                                         a[j].uip++
1684                                         a[j].s = str(i)
1685                                         runtime.Gosched()
1686                                 }
1687                         }
1688                 },
1689                 sliceT: func() {
1690                         a := make([]structT, length)
1691                         for i := 0; i < len(a); i++ {
1692                                 a[i] = newStructT()
1693                         }
1694                         for i := 0; i < mods; i++ {
1695                                 for j := 0; j < len(a); j++ {
1696                                         a[j].u8++
1697                                         a[j].u16++
1698                                         a[j].u32++
1699                                         a[j].u64++
1700                                         a[j].i8++
1701                                         a[j].i16++
1702                                         a[j].i32++
1703                                         a[j].i64++
1704                                         a[j].f32 *= 1.01
1705                                         a[j].f64 *= 1.01
1706                                         a[j].c64 = complex(real(a[j].c64)*1.01, imag(a[j].c64)*1.01)
1707                                         a[j].c128 = complex(real(a[j].c128)*1.01, imag(a[j].c128)*1.01)
1708                                         a[j].b++
1709                                         a[j].r++
1710                                         a[j].u++
1711                                         a[j].in++
1712                                         a[j].uip++
1713                                         a[j].s = str(i)
1714                                         runtime.Gosched()
1715                                 }
1716                         }
1717                 },
1718                 mapT: func() {
1719                         a := make(map[structT]structT)
1720                         for i := 0; i < length; i++ {
1721                                 m := newStructT()
1722                                 m.in = i
1723                                 a[m] = newStructT()
1724                                 runtime.Gosched()
1725                         }
1726                         for i := 0; i < mods; i++ {
1727                                 for j, _ := range a {
1728                                         m := a[j]
1729                                         m.u8++
1730                                         m.u16++
1731                                         m.u32++
1732                                         m.u64++
1733                                         m.i8++
1734                                         m.i16++
1735                                         m.i32++
1736                                         m.i64++
1737                                         m.f32 *= 1.01
1738                                         m.f64 *= 1.01
1739                                         m.c64 = complex(real(a[j].c64)*1.01, imag(a[j].c64)*1.01)
1740                                         m.c128 = complex(real(a[j].c128)*1.01, imag(a[j].c128)*1.01)
1741                                         m.b++
1742                                         m.r++
1743                                         m.u++
1744                                         m.in++
1745                                         m.uip++
1746                                         m.s = str(i)
1747                                         a[j] = m
1748                                         runtime.Gosched()
1749                                 }
1750                                 runtime.Gosched()
1751                         }
1752                 },
1753                 mapPointerKeyT: func() {
1754                         a := make(map[*structT]structT)
1755                         f := func() *structT {
1756                                 m := newStructT()
1757                                 return &m
1758                         }
1759                         for i := 0; i < length; i++ {
1760                                 m := f()
1761                                 m.in = i
1762                                 a[m] = newStructT()
1763                                 runtime.Gosched()
1764                         }
1765                         for i := 0; i < mods; i++ {
1766                                 for j, _ := range a {
1767                                         m := a[j]
1768                                         m.u8++
1769                                         m.u16++
1770                                         m.u32++
1771                                         m.u64++
1772                                         m.i8++
1773                                         m.i16++
1774                                         m.i32++
1775                                         m.i64++
1776                                         m.f32 *= 1.01
1777                                         m.f64 *= 1.01
1778                                         m.c64 = complex(real(a[j].c64)*1.01, imag(a[j].c64)*1.01)
1779                                         m.c128 = complex(real(a[j].c128)*1.01, imag(a[j].c128)*1.01)
1780                                         m.b++
1781                                         m.r++
1782                                         m.u++
1783                                         m.in++
1784                                         m.uip++
1785                                         m.s = str(i)
1786                                         a[j] = m
1787                                         runtime.Gosched()
1788                                 }
1789                                 runtime.Gosched()
1790                         }
1791                 },
1792                 chanT: func() {
1793                         a := make(chan structT)
1794                         for i := 0; i < mods; i++ {
1795                                 go func() { a <- newStructT() }()
1796                                 <-a
1797                                 runtime.Gosched()
1798                         }
1799                 },
1800                 interfaceT: func() {
1801                         a := interface{}(newStructT())
1802                         for i := 0; i < mods; i++ {
1803                                 a = a.(structT)
1804                                 runtime.Gosched()
1805                         }
1806                 },
1807         },
1808 }
1809
1810 type structT struct {
1811         u8   uint8
1812         u16  uint16
1813         u32  uint32
1814         u64  uint64
1815         i8   int8
1816         i16  int16
1817         i32  int32
1818         i64  int64
1819         f32  float32
1820         f64  float64
1821         c64  complex64
1822         c128 complex128
1823         b    byte
1824         r    rune
1825         u    uint
1826         in   int
1827         uip  uintptr
1828         s    string
1829 }
1830
1831 func newStructT() structT {
1832         return structT{
1833                 f32:  1.01,
1834                 f64:  1.01,
1835                 c64:  complex(float32(1.01), float32(1.01)),
1836                 c128: complex(float64(1.01), float64(1.01)),
1837         }
1838 }
1839
1840 func str(in int) string {
1841         switch in % 3 {
1842         case 0:
1843                 return "Hello"
1844         case 1:
1845                 return "world"
1846         case 2:
1847                 return "!"
1848         }
1849         return "?"
1850 }