()
| 34 | } |
| 35 | |
| 36 | func main() { |
| 37 | if len(os.Args) != 4 { |
| 38 | panic("usage: complexity-diff <old> <new> <diff>") |
| 39 | } |
| 40 | |
| 41 | oldFile := os.Args[1] |
| 42 | newFile := os.Args[2] |
| 43 | diffFile := os.Args[3] |
| 44 | |
| 45 | oldRecords, err := loadRecords(oldFile) |
| 46 | if err != nil { |
| 47 | panic(err) |
| 48 | } |
| 49 | newRecords, err := loadRecords(newFile) |
| 50 | if err != nil { |
| 51 | panic(err) |
| 52 | } |
| 53 | |
| 54 | diffRecords := calcDiffRecords(oldRecords, newRecords, true) |
| 55 | |
| 56 | minMaxInsnsProcessed := calcMinMax(diffRecords, func(r verifierComplexityRecord) int { |
| 57 | return r.InsnsProcessed |
| 58 | }) |
| 59 | printTop15MinMax("largest differences by instructions processed", minMaxInsnsProcessed, percentInsnsProcessed, colorRelativeChange) |
| 60 | |
| 61 | minMaxStackDepth := calcMinMax(diffRecords, func(r verifierComplexityRecord) int { |
| 62 | return r.StackDepth |
| 63 | }) |
| 64 | printTop15MinMax("largest differences by stack depth", minMaxStackDepth, percentStackDepth, colorRelativeChange) |
| 65 | |
| 66 | minMaxMapCount := calcMinMax(diffRecords, func(r verifierComplexityRecord) int { |
| 67 | return r.MapCount |
| 68 | }) |
| 69 | printTop15MinMax("largest differences by map count", minMaxMapCount, percentMapCount, colorRelativeChange) |
| 70 | |
| 71 | var sortedNewRecords []verifierComplexityRecord |
| 72 | for _, key := range slices.Sorted(maps.Keys(newRecords)) { |
| 73 | sortedNewRecords = append(sortedNewRecords, newRecords[key]) |
| 74 | } |
| 75 | |
| 76 | minMaxInsnsProcessed = calcMinMax(sortedNewRecords, func(r verifierComplexityRecord) int { |
| 77 | return r.InsnsProcessed |
| 78 | }) |
| 79 | printTop15MinMax("largest instructions processed", minMaxInsnsProcessed, percentInsnsProcessed, colorAbsoluteValueExponential) |
| 80 | |
| 81 | minMaxStackDepth = calcMinMax(sortedNewRecords, func(r verifierComplexityRecord) int { |
| 82 | return r.StackDepth |
| 83 | }) |
| 84 | printTop15MinMax("largest stack depth", minMaxStackDepth, percentStackDepth, colorAbsoluteValue) |
| 85 | |
| 86 | minMaxMapCount = calcMinMax(sortedNewRecords, func(r verifierComplexityRecord) int { |
| 87 | return r.MapCount |
| 88 | }) |
| 89 | printTop15MinMax("largest map count", minMaxMapCount, percentMapCount, colorAbsoluteValue) |
| 90 | |
| 91 | diffRecords = calcDiffRecords(oldRecords, newRecords, false) |
| 92 | |
| 93 | // Sort diff records to be more logically grouped for human consumption, even though its JSON. |
nothing calls this directly
no test coverage detected
searching dependent graphs…