Anonymous user
Knapsack problem/Bounded/Go test: Difference between revisions
m
fix typo
(Add Go test file and instructions) |
m (fix typo) |
||
(One intermediate revision by one other user not shown) | |||
Line 38:
If you're unfamiliar with using benchmarks within go tests:
* Put the above into a <tt>*_test.go</tt> file in the same directory as the <tt>*.go</tt> file from [[Knapsack_problem/Bounded#Go]] (and with no other Go source files)
* Get and build [http://godoc.org/
* Run <code>go test -v -bench=. > bench.out.orig</code> (or <code>go test -bench=. | tee bench.out.orig</code> or some such)
* Make changes as desired
* Re-run the benchmark this time saving the output to a different file, e.g. <tt>bench.out</tt>
* Compare the results with "<code>benchcmp bench.out{.orig,}</code>" (or if
For example, when I changed the code to use a <code>struct</code> as a map key instead of a string, the output was:
<pre>
|