Commit Graph

7 Commits

Author SHA1 Message Date
Zach Ramsay 87cb57c3e5 linting: fixup some stuffs 2017-10-04 18:16:48 -04:00
Zach Ramsay fe66a683bc linter: add metalinter to Makefile & apply some fixes 2017-10-04 17:53:56 -04:00
Emmanuel Odeke ae9c5b1ca0 hd: optimize ReverseBytes + add tests
* Optimized ReverseBytes to:
a) Minimally allocate --> 60.0% reduction in the number of allocations
b) Only walk halfway the length of the string thus performing
byte swaps from left to right. Improves the performance as well.
Complexity is O(n/2) instead of O(n) which is still O(n) but
benchmarks show the new time is in deed 1/2 of the original time.

* Added unit tests and some common cases to ensure correctness.

* Benchmark shoot out results:
```shell
name            old time/op    new time/op    delta
ReverseBytes-4     554ns ± 4%     242ns ± 3%  -56.20%  (p=0.000 n=10+10)

name            old alloc/op   new alloc/op   delta
ReverseBytes-4      208B ± 0%      114B ± 0%  -45.19%  (p=0.000 n=10+10)

name            old allocs/op  new allocs/op  delta
ReverseBytes-4      10.0 ± 0%       4.0 ± 0%  -60.00%  (p=0.000 n=10+10)
```
2017-07-28 12:21:41 -06:00
Jae Kwon e49fdf7be7 Add HD functions 2017-04-08 22:57:59 -07:00
Ethan Buchman 6fddcdf245 hd test: check masters too 2017-03-22 20:13:16 -04:00
Ethan Buchman c6be97c71c error testing the hd 2017-03-22 16:45:30 -04:00
Ethan Buchman ce9c57fca8 hd test 2017-03-22 15:59:48 -04:00