mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-24 03:43:18 -04:00
refactor(similarity_ordering): remove unused code
This commit is contained in:
parent
af8722da5e
commit
c570cd2fab
@ -25,7 +25,6 @@
|
||||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
#include <dwarfs/writer/internal/receiver.h>
|
||||
@ -81,10 +80,10 @@ class similarity_ordering {
|
||||
dwarfs::internal::worker_group& wg,
|
||||
similarity_ordering_options const& opts);
|
||||
|
||||
void order_nilsimsa(
|
||||
basic_array_similarity_element_view<256, uint64_t> const& ev,
|
||||
receiver<std::vector<index_value_type>> rec,
|
||||
std::optional<std::vector<index_value_type>> index = std::nullopt) const {
|
||||
void
|
||||
order_nilsimsa(basic_array_similarity_element_view<256, uint64_t> const& ev,
|
||||
receiver<std::vector<index_value_type>> rec,
|
||||
std::vector<index_value_type> index) const {
|
||||
impl_->order_nilsimsa(ev, std::move(rec), std::move(index));
|
||||
}
|
||||
|
||||
@ -92,10 +91,10 @@ class similarity_ordering {
|
||||
public:
|
||||
virtual ~impl() = default;
|
||||
|
||||
virtual void order_nilsimsa(
|
||||
basic_array_similarity_element_view<256, uint64_t> const& ev,
|
||||
receiver<std::vector<index_value_type>> rec,
|
||||
std::optional<std::vector<index_value_type>> index) const = 0;
|
||||
virtual void
|
||||
order_nilsimsa(basic_array_similarity_element_view<256, uint64_t> const& ev,
|
||||
receiver<std::vector<index_value_type>> rec,
|
||||
std::vector<index_value_type> index) const = 0;
|
||||
};
|
||||
|
||||
private:
|
||||
|
@ -310,10 +310,9 @@ class similarity_ordering_ final : public similarity_ordering::impl {
|
||||
, opts_{opts} {}
|
||||
|
||||
void order_nilsimsa(nilsimsa_element_view const& ev, receiver<index_type> rec,
|
||||
std::optional<index_type> index) const override;
|
||||
index_type index) const override;
|
||||
|
||||
private:
|
||||
index_type build_index(similarity_element_view const& ev) const;
|
||||
duplicates_map
|
||||
find_duplicates(similarity_element_view const& ev, index_type& index) const;
|
||||
|
||||
@ -363,7 +362,7 @@ class similarity_ordering_ final : public similarity_ordering::impl {
|
||||
|
||||
template <size_t Bits, typename BitsType>
|
||||
void order_impl(
|
||||
receiver<index_type>&& rec, std::optional<index_type> idx,
|
||||
receiver<index_type>&& rec, index_type idx,
|
||||
basic_array_similarity_element_view<Bits, BitsType> const& ev) const;
|
||||
|
||||
LOG_PROXY_DECL(LoggerPolicy);
|
||||
@ -372,29 +371,6 @@ class similarity_ordering_ final : public similarity_ordering::impl {
|
||||
similarity_ordering_options const opts_;
|
||||
};
|
||||
|
||||
template <typename LoggerPolicy>
|
||||
auto similarity_ordering_<LoggerPolicy>::build_index(
|
||||
similarity_element_view const& ev) const -> index_type {
|
||||
index_type index;
|
||||
|
||||
{
|
||||
auto tt = LOG_TIMED_TRACE;
|
||||
|
||||
index.reserve(ev.size());
|
||||
for (index_value_type i = 0; i < ev.size(); ++i) {
|
||||
if (ev.exists(i)) {
|
||||
index.push_back(i);
|
||||
}
|
||||
}
|
||||
index.shrink_to_fit();
|
||||
|
||||
tt << opts_.context << "build index: " << ev.size() << " -> "
|
||||
<< index.size();
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
template <typename LoggerPolicy>
|
||||
auto similarity_ordering_<LoggerPolicy>::find_duplicates(
|
||||
similarity_element_view const& ev, index_type& index) const
|
||||
@ -676,16 +652,8 @@ void similarity_ordering_<LoggerPolicy>::collect_rec(
|
||||
template <typename LoggerPolicy>
|
||||
template <size_t Bits, typename BitsType>
|
||||
void similarity_ordering_<LoggerPolicy>::order_impl(
|
||||
receiver<index_type>&& rec, std::optional<index_type> idx,
|
||||
receiver<index_type>&& rec, index_type index,
|
||||
basic_array_similarity_element_view<Bits, BitsType> const& ev) const {
|
||||
index_type index;
|
||||
|
||||
if (idx) {
|
||||
index = *idx;
|
||||
} else {
|
||||
index = build_index(ev);
|
||||
}
|
||||
|
||||
LOG_DEBUG << opts_.context
|
||||
<< "total distance before ordering: " << total_distance(ev, index);
|
||||
|
||||
@ -715,7 +683,7 @@ void similarity_ordering_<LoggerPolicy>::order_impl(
|
||||
template <typename LoggerPolicy>
|
||||
void similarity_ordering_<LoggerPolicy>::order_nilsimsa(
|
||||
nilsimsa_element_view const& ev, receiver<index_type> rec,
|
||||
std::optional<index_type> index) const {
|
||||
index_type index) const {
|
||||
wg_.add_job(
|
||||
[this, rec = std::move(rec), idx = std::move(index), &ev]() mutable {
|
||||
order_impl(std::move(rec), std::move(idx), ev);
|
||||
|
Loading…
x
Reference in New Issue
Block a user