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

Added initial benchmarks for deduplicate filter. #2118

Closed
wants to merge 2 commits into from

Conversation

bwplotka
Copy link
Member

The part we did together with @khyatisoneji (pair programming)

The script I used:

#!/usr/bin/env bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

cd ${DIR}/../

RUN="${1}-dedupfilter"
mkdir -p ${DIR}/bench_outs/${RUN}

for TEST in BenchmarkDeduplicateFilter_Filter/v0 BenchmarkDeduplicateFilter_Filter/v1
do
echo "Running ${TEST} run ${RUN}"
go test -bench=${TEST} -run=^$ -benchmem -memprofile ${DIR}/bench_outs/${RUN}/memprofile${TEST//\//-}.out -timeout 10m -benchtime 30s ./pkg/block | tee  ${DIR}/bench_outs/${RUN}/bench${TEST//\//-}.out
done

sed 's/BenchmarkDeduplicateFilter_Filter\/v0/BenchmarkDeduplicateFilter_Filter/g' ${DIR}/bench_outs/${RUN}/benchBenchmarkDeduplicateFilter_Filter-v0.out > ${DIR}/bench_outs/${RUN}/bench_new.out
sed 's/BenchmarkDeduplicateFilter_Filter\/v1/BenchmarkDeduplicateFilter_Filter/g' ${DIR}/bench_outs/${RUN}/benchBenchmarkDeduplicateFilter_Filter-v1.out > ${DIR}/bench_outs/${RUN}/bench_old.out

benchcmp ${DIR}/bench_outs/${RUN}/bench_old.out ${DIR}/bench_outs/${RUN}/bench_new.out | tee ${DIR}/bench_outs/${RUN}/bench.out

So far @khyatisoneji it looks like it's CPU vs memory tradeoff (: I like that your algorithm has less allocations, but it's quite slow. Not sure yet what wins. I think we can improve your algorithm even more so we can save some CPU. We could do more CPU profiling while benchmarking.

benchmark                                    old ns/op      new ns/op     delta
BenchmarkDeduplicateFilter_Filter/#00-12     571441451      18737137      -96.72%
BenchmarkDeduplicateFilter_Filter/#01-12     5201142904     72444063      -98.61%

benchmark                                    old allocs     new allocs     delta
BenchmarkDeduplicateFilter_Filter/#00-12     3050           4111           +34.79%
BenchmarkDeduplicateFilter_Filter/#01-12     10502          9753           -7.13%

benchmark                                    old bytes     new bytes     delta
BenchmarkDeduplicateFilter_Filter/#00-12     243936        10898912      +4367.94%
BenchmarkDeduplicateFilter_Filter/#01-12     840074        41400505      +4828.20%

TODO(@khyatisoneji ): Make it parallel for resolution (!): For test case number 2.

Pushed that to my fork and will add write access to my fork to you @khyatisoneji, so you can play with it as well!

Signed-off-by: Bartlomiej Plotka bwplotka@gmail.com

Also reordered test cases as we expect those to be sorted.

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
@bwplotka bwplotka changed the title Added initial benchmarks with for deduplicate filter. Added initial benchmarks for deduplicate filter. Feb 10, 2020
Signed-off-by: khyatisoneji <khyatisoneji5@gmail.com>
@bwplotka
Copy link
Member Author

No longer working on this. We need this, but help wanted for someone to finish it (:

Maybe @khyatisoneji (:

cc #2174

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