|
41 | 41 | nmaxs int // number of maximums to discard
|
42 | 42 | }
|
43 | 43 |
|
| 44 | +[unsafe] |
| 45 | +fn (mut result CmdResult) free() { |
| 46 | + unsafe { |
| 47 | + result.cmd.free() |
| 48 | + result.outputs.free() |
| 49 | + result.oms.free() |
| 50 | + result.summary.free() |
| 51 | + result.timings.free() |
| 52 | + result.atiming.free() |
| 53 | + } |
| 54 | +} |
| 55 | + |
| 56 | +[unsafe] |
| 57 | +fn (mut context Context) free() { |
| 58 | + unsafe { |
| 59 | + context.commands.free() |
| 60 | + context.results.free() |
| 61 | + context.cmd_template.free() |
| 62 | + context.cmd_params.free() |
| 63 | + context.cline.free() |
| 64 | + context.cgoback.free() |
| 65 | + } |
| 66 | +} |
| 67 | + |
44 | 68 | struct Aints {
|
45 | 69 | values []int
|
46 | 70 | mut:
|
|
52 | 76 | nmaxs int // number of discarded slowest results
|
53 | 77 | }
|
54 | 78 |
|
| 79 | +[unsafe] |
| 80 | +fn (mut a Aints) free() { |
| 81 | + unsafe { a.values.free() } |
| 82 | +} |
| 83 | + |
55 | 84 | fn new_aints(ovals []int, extreme_mins int, extreme_maxs int) Aints {
|
56 | 85 | mut res := Aints{
|
57 | 86 | values: ovals // remember the original values
|
@@ -155,9 +184,9 @@ fn (mut context Context) parse_options() {
|
155 | 184 | exit(1)
|
156 | 185 | }
|
157 | 186 | context.commands = context.expand_all_commands(commands)
|
158 |
| - context.results = []CmdResult{len: context.commands.len, cap: 100, init: CmdResult{ |
159 |
| - outputs: []string{cap: 1000} |
160 |
| - timings: []int{cap: 1000} |
| 187 | + context.results = []CmdResult{len: context.commands.len, cap: 10, init: CmdResult{ |
| 188 | + outputs: []string{cap: 200} |
| 189 | + timings: []int{cap: 200} |
161 | 190 | }}
|
162 | 191 | if context.use_newline {
|
163 | 192 | context.cline = '\n'
|
@@ -242,7 +271,9 @@ fn (mut context Context) run() {
|
242 | 271 | trimed_output := res.output.trim_right('\r\n')
|
243 | 272 | trimed_normalized := trimed_output.replace('\r\n', '\n')
|
244 | 273 | lines := trimed_normalized.split('\n')
|
245 |
| - context.results[icmd].outputs << lines |
| 274 | + for line in lines { |
| 275 | + context.results[icmd].outputs << line |
| 276 | + } |
246 | 277 | context.results[icmd].timings << duration
|
247 | 278 | sum += duration
|
248 | 279 | runs++
|
|
0 commit comments