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

Feature/optimize human printer #175

Merged
merged 1 commit into from
Aug 24, 2016

Conversation

arichardet
Copy link
Contributor

@arichardet arichardet commented Aug 18, 2016

Optimized human printer and added benchmarks to tests

Stats on improvements:

name                       old time/op    new time/op    delta
DrawNodeNoChanges             108µs ± 2%      62µs ± 8%  -42.47%        (p=0.000 n=20+19)
DrawNodeNoChangesFiltered    6.63µs ± 5%    6.55µs ±10%     ~           (p=0.091 n=19+20)
DrawNodeMetaFiltered         6.65µs ± 3%    6.42µs ± 2%   -3.49%        (p=0.000 n=19+20)
DrawNodeChanges               122µs ± 2%      59µs ± 2%  -51.69%        (p=0.000 n=18+20)
DrawNodeError                 124µs ±13%      59µs ± 1%  -52.43%        (p=0.000 n=19+20)

name                       old alloc/op   new alloc/op   delta
DrawNodeNoChanges            18.2kB ± 0%     6.2kB ± 0%  -66.09%        (p=0.000 n=20+20)
DrawNodeNoChangesFiltered    3.86kB ± 0%    3.86kB ± 0%     ~     (all samples are equal)
DrawNodeMetaFiltered         3.86kB ± 0%    3.86kB ± 0%     ~     (all samples are equal)
DrawNodeChanges              19.9kB ± 0%     6.5kB ± 0%  -67.52%        (p=0.000 n=20+20)
DrawNodeError                20.2kB ± 0%     6.5kB ± 0%  -68.03%        (p=0.000 n=20+20)

name                       old allocs/op  new allocs/op  delta
DrawNodeNoChanges               381 ± 0%       122 ± 0%  -67.98%        (p=0.000 n=20+20)
DrawNodeNoChangesFiltered      82.0 ± 0%      82.0 ± 0%     ~     (all samples are equal)
DrawNodeMetaFiltered           82.0 ± 0%      82.0 ± 0%     ~     (all samples are equal)
DrawNodeChanges                 417 ± 0%       123 ± 0%  -70.50%        (p=0.000 n=20+20)
DrawNodeError                   425 ± 0%       123 ± 0%  -71.06%        (p=0.000 n=20+20)

@arichardet arichardet force-pushed the feature/optimize-human-printer branch 3 times, most recently from 67b0f38 to c81f675 Compare August 23, 2016 14:12
)
}

func benchmarkDrawNodesCustomPrinter(h *human.Printer, id string, in Printable, out string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

is out ever used? It doesn't look like it, here.

@BrianHicks
Copy link
Contributor

What happens if you cache the rendered templates instead of just the template functions?

@arichardet arichardet force-pushed the feature/optimize-human-printer branch from c81f675 to 862d6a4 Compare August 23, 2016 20:55
@arichardet
Copy link
Contributor Author

Addressed feedback and made changes to human printer tests.
Attempted to cache for further improvements; however, the changes were either negligible or worse.

@rebeccaskinner rebeccaskinner merged commit f5f9223 into master Aug 24, 2016
@rebeccaskinner rebeccaskinner deleted the feature/optimize-human-printer branch August 24, 2016 14:54
BrianHicks pushed a commit that referenced this pull request Dec 22, 2016
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.

3 participants