@@ -12,8 +12,8 @@ struct differential {
1212 m_representative_offsets.push_back (0 );
1313 }
1414
15- void init_colors_builder (uint64_t num_docs ) {
16- m_num_docs = num_docs ;
15+ void init_colors_builder (uint64_t num_colors ) {
16+ m_num_colors = num_colors ;
1717 m_num_total_integers = 0 ;
1818 m_num_lists = 0 ;
1919 }
@@ -99,7 +99,7 @@ struct differential {
9999 }
100100
101101 void build (differential& d) {
102- d.m_num_docs = m_num_docs ;
102+ d.m_num_colors = m_num_colors ;
103103 d.m_colors .swap (m_bvb.bits ());
104104 d.m_clusters .build (&m_clusters);
105105
@@ -132,7 +132,7 @@ struct differential {
132132 pthash::bit_vector_builder m_clusters;
133133 uint64_t m_num_total_integers, m_num_lists;
134134
135- uint64_t m_num_docs ;
135+ uint64_t m_num_colors ;
136136 uint64_t m_prev_cluster_id;
137137 std::vector<uint64_t > m_representative_offsets, m_list_offsets;
138138 };
@@ -158,11 +158,11 @@ struct differential {
158158 m_size = util::read_delta (m_differential_list_it);
159159
160160 m_curr_differential_val = m_differential_list_size == 0
161- ? num_docs ()
161+ ? num_colors ()
162162 : util::read_delta (m_differential_list_it);
163163 m_prev_differential_val = 0 ;
164164 m_curr_representative_val =
165- m_representative_size == 0 ? num_docs () : util::read_delta (m_representative_it);
165+ m_representative_size == 0 ? num_colors () : util::read_delta (m_representative_it);
166166 m_prev_representative_val = 0 ;
167167
168168 m_pos_in_differential_list = 0 ;
@@ -178,7 +178,7 @@ struct differential {
178178 void next () {
179179 if (m_pos_in_representative >= m_representative_size &&
180180 m_pos_in_differential_list >= m_differential_list_size) {
181- m_curr_val = num_docs ();
181+ m_curr_val = num_colors ();
182182 return ;
183183 }
184184 if (m_pos_in_representative >= m_representative_size ||
@@ -193,12 +193,12 @@ struct differential {
193193 void operator ++() { next (); }
194194
195195 void next_geq (const uint64_t lower_bound) {
196- assert (lower_bound <= num_docs ());
196+ assert (lower_bound <= num_colors ());
197197 while (value () < lower_bound) next ();
198198 assert (value () >= lower_bound);
199199 }
200200
201- uint32_t num_docs () const { return m_ptr->m_num_docs ; }
201+ uint32_t num_colors () const { return m_ptr->m_num_colors ; }
202202 uint64_t differential_list_size () const { return m_differential_list_size; }
203203
204204 int type () const { return list_type::differential_list; }
@@ -221,7 +221,7 @@ struct differential {
221221 m_curr_representative_val =
222222 m_prev_representative_val + util::read_delta (m_representative_it) + 1 ;
223223 } else {
224- m_curr_representative_val = num_docs ();
224+ m_curr_representative_val = num_colors ();
225225 }
226226 }
227227
@@ -232,7 +232,7 @@ struct differential {
232232 m_curr_differential_val =
233233 m_prev_differential_val + util::read_delta (m_differential_list_it) + 1 ;
234234 } else {
235- m_curr_differential_val = num_docs ();
235+ m_curr_differential_val = num_colors ();
236236 }
237237 }
238238
@@ -259,10 +259,10 @@ struct differential {
259259
260260 uint64_t num_color_sets () const { return m_list_offsets.size () - 1 ; }
261261 uint64_t num_partitions () const { return m_clusters.num_ones () + 1 ; }
262- uint64_t num_docs () const { return m_num_docs ; }
262+ uint64_t num_colors () const { return m_num_colors ; }
263263
264264 uint64_t num_bits () const {
265- return sizeof (m_num_docs ) * 8 + m_representative_offsets.num_bits () +
265+ return sizeof (m_num_colors ) * 8 + m_representative_offsets.num_bits () +
266266 m_list_offsets.num_bits () + essentials::vec_bytes (m_colors) * 8 +
267267 m_clusters.bytes () * 8 ;
268268 }
@@ -271,16 +271,16 @@ struct differential {
271271 std::cout << " Color statistics:\n " ;
272272 std::cout << " Number of partitions: " << num_partitions () << std::endl;
273273
274- uint64_t num_representative_offsets = m_representative_offsets.num_bits ();
275- uint64_t num_list_offsets = m_list_offsets.num_bits ();
276- uint64_t num_colors = essentials::vec_bytes (m_colors) * 8 ;
277- uint64_t num_clusters = m_clusters.size ();
274+ uint64_t num_bits_representative_offsets = m_representative_offsets.num_bits ();
275+ uint64_t num_bits_list_offsets = m_list_offsets.num_bits ();
276+ uint64_t num_bits_colors = essentials::vec_bytes (m_colors) * 8 ;
278277
278+ uint64_t num_clusters = m_clusters.size ();
279279 uint64_t num_representatives = 0 ;
280280 uint64_t num_differential_lists = 0 ;
281281 uint64_t num_metadata = 0 ;
282282
283- uint64_t num_docs_tenth = num_docs () / 10 ;
283+ uint64_t num_colors_tenth = num_colors () / 10 ;
284284
285285 std::vector<uint64_t > distribution (11 , 0 );
286286
@@ -322,29 +322,31 @@ struct differential {
322322 prev_position = it.position ();
323323 }
324324 uint64_t q = 0 ;
325- if (num_docs_tenth != 0 )
326- q = size / (num_docs_tenth) > 10 ? 10 : size / (num_docs_tenth);
325+ if (num_colors_tenth != 0 ) {
326+ q = size / (num_colors_tenth) > 10 ? 10 : size / (num_colors_tenth);
327+ }
327328
328329 distribution[q]++;
329330 }
330331
331332 assert (num_bits () > 0 );
332- assert (num_colors > 0 );
333+ assert (num_bits_colors > 0 );
333334
334- std::cout << " representative offsets: " << num_representative_offsets / 8 << " bytes ("
335- << (num_representative_offsets * 100.0 ) / num_bits () << " %)" << std::endl;
336- std::cout << " differential list offsets: " << num_list_offsets / 8 << " bytes ("
337- << (num_list_offsets * 100.0 ) / num_bits () << " %)" << std::endl;
335+ std::cout << " representative offsets: " << num_bits_representative_offsets / 8
336+ << " bytes (" << (num_bits_representative_offsets * 100.0 ) / num_bits () << " %)"
337+ << std::endl;
338+ std::cout << " differential list offsets: " << num_bits_list_offsets / 8 << " bytes ("
339+ << (num_bits_list_offsets * 100.0 ) / num_bits () << " %)" << std::endl;
338340 std::cout << " clusters: " << num_clusters / 8 << " bytes ("
339341 << (num_clusters * 100.0 ) / num_bits () << " %)" << std::endl;
340- std::cout << " differential colors: " << num_colors / 8 << " bytes ("
341- << (num_colors * 100.0 ) / num_bits () << " %)" << std::endl;
342+ std::cout << " differential colors: " << num_bits_colors / 8 << " bytes ("
343+ << (num_bits_colors * 100.0 ) / num_bits () << " %)" << std::endl;
342344 std::cout << " representatives: " << num_representatives / 8 << " bytes ("
343- << (num_representatives * 100.0 ) / num_colors << " %)" << std::endl;
345+ << (num_representatives * 100.0 ) / num_bits_colors << " %)" << std::endl;
344346 std::cout << " differential lists: " << num_differential_lists / 8 << " bytes ("
345- << (num_differential_lists * 100.0 ) / num_colors << " %)" << std::endl;
347+ << (num_differential_lists * 100.0 ) / num_bits_colors << " %)" << std::endl;
346348 std::cout << " metadata: " << num_metadata / 8 << " bytes ("
347- << (num_metadata * 100.0 ) / num_colors << " %)" << std::endl;
349+ << (num_metadata * 100.0 ) / num_bits_colors << " %)" << std::endl;
348350 std::cout << " differential lists size distribution:" << std::endl;
349351 for (uint64_t partition = 0 ; partition < 11 ; partition++) {
350352 std::cout << distribution[partition] << " " ;
@@ -365,14 +367,14 @@ struct differential {
365367private:
366368 template <typename Visitor, typename T>
367369 static void visit_impl (Visitor& visitor, T&& t) {
368- visitor.visit (t.m_num_docs );
370+ visitor.visit (t.m_num_colors );
369371 visitor.visit (t.m_representative_offsets );
370372 visitor.visit (t.m_list_offsets );
371373 visitor.visit (t.m_colors );
372374 visitor.visit (t.m_clusters );
373375 }
374376
375- uint32_t m_num_docs ;
377+ uint32_t m_num_colors ;
376378
377379 sshash::ef_sequence<false > m_representative_offsets, m_list_offsets;
378380
0 commit comments