Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit verbosity of reporter output #215

Merged
merged 1 commit into from
Jun 12, 2020
Merged

Limit verbosity of reporter output #215

merged 1 commit into from
Jun 12, 2020

Conversation

dsnet
Copy link
Collaborator

@dsnet dsnet commented Jun 11, 2020

A common complaint is that the reporter it prints out too much
irrelevant information, resulting in a low signal-to-noise ratio.
Improve this metric by imposing a verbosity limit. For nodes that
are equal, we set the verbosity level is a lower value than when
the nodes are inequal.

Other minor changes:

  • Adjust heuristic for triple-quote usage to operate on more cases.
  • Elide type more aggressively for equal nodes.
  • Printing the address for a slice includes the length and capacity.
  • The pointed-at value for map keys are printed.

@dsnet
Copy link
Collaborator Author

dsnet commented Jun 11, 2020

The verbosity levels could use more fine tuning, but this is good enough for now, and much better than before in my opinion.

Upcoming changes:

  • Add logic for the reporter work harder on the output if it is ambiguous
  • Add better cycle formatting logic. Right now, if a cycle is detected, the user has no idea where it occurred.

cmp/report_reflect.go Outdated Show resolved Hide resolved

// PrintAddresses controls whether to print the address of all pointers,
// slice elements, and maps.
PrintAddresses bool

// VerbosityLevel controls the amount of amount of output to produce.
// A higher value produces more output. A value of zero or lwoer produces

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/lwoer/lower/

if opts.VerbosityLevel < 0 {
return 0
}
return uint(opts.VerbosityLevel)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to set a limit for this? Seems like a good number of callers for verbosity() use the return value in a shift operation. I suppose it should shift only to certain number of bits?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I set it to a maximum of 16, which is half the width of an int on a 32-bit system.

cmp/testdata/diffs Show resolved Hide resolved
A common complaint is that the reporter it prints out too much
irrelevant information, resulting in a low signal-to-noise ratio.
Improve this metric by imposing a verbosity limit. For nodes that
are equal, we set the verbosity level is a lower value than when
the nodes are inequal.

Other minor changes:
* Adjust heuristic for triple-quote usage to operate on more cases.
* Elide type more aggressively for equal nodes.
* Printing the address for a slice includes the length and capacity.
* The pointed-at value for map keys are printed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants