Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–162 unchanged (162 lines)
163 if (!_spilledSortedSegments.empty()) {
164 // We've exceeded the memory limit and spilled some data to disk, which means that there
165 // might still be data in _accumulatedValues that was incorporated into the algorithm, but
166 // not enough to hit the limit and spill again. So that we don't miss those values, we force
167 // the algorithm to spill again here so that all of the data is on disk when we sort it.
168 spill();
169
170 std::function<int(const Value&, const Value&)> comparator =
171 [valueComparator = ValueComparator()](const Value& lhs, const Value& rhs) -> int {
172 return valueComparator.compare(lhs, rhs);
173 };
174
175 // Initializes _sorterIterator as a MergeIterator that merge sorts the spilled sorted
176 // segments of data together so that values can be iterated through in sorted order.
…lines 177–223 unchanged (47 lines)

After

…lines 1–162 unchanged (162 lines)
163 if (!_spilledSortedSegments.empty()) {
164 // We've exceeded the memory limit and spilled some data to disk, which means that there
165 // might still be data in _accumulatedValues that was incorporated into the algorithm, but
166 // not enough to hit the limit and spill again. So that we don't miss those values, we force
167 // the algorithm to spill again here so that all of the data is on disk when we sort it.
168 spill();
169
170 auto comparator = [valueComparator = ValueComparator()](const Value& lhs,
171 const Value& rhs) -> int {
172 return valueComparator.compare(lhs, rhs);
173 };
174
175 // Initializes _sorterIterator as a MergeIterator that merge sorts the spilled sorted
176 // segments of data together so that values can be iterated through in sorted order.
…lines 177–223 unchanged (47 lines)

Before

translation_unit
comment "/**\n * Copyright (C) 2024-present MongoDB, Inc.\n *\n * "...
preproc_include
#include "#include"
string_literal
" "\""
string_content "mongo/db/pipeline/percentile_algo_accurate.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "mongo/db/query/query_execution_knobs_gen.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "mongo/db/query/query_integration_knobs_gen.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "mongo/db/query/query_optimization_knobs_gen.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "mongo/db/sorter/file_based_spiller.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "mongo/db/sorter/sorter_template_defs.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "mongo/platform/atomic_word.h"
" "\""
preproc_include
#include "#include"
system_lib_string "<algorithm>"
preproc_include
#include "#include"
system_lib_string "<cmath>"
namespace_definition
namespace "namespace"
namespace_identifier "mongo"
declaration_list
{ "{"
using_declaration
using "using"
qualified_identifier
namespace_identifier "std"
:: "::"
identifier "vector"
; ";"
comment "/**\n * Generates a new file name on each call using a static"...
namespace_definition (+57 nodes collapsed)
comment "// namespace"
function_definition (+76 nodes collapsed)
function_definition (+334 nodes collapsed)
function_definition (+106 nodes collapsed)
function_definition (+38 nodes collapsed)
comment "/*\n * Serialize data currently in algorithm by casting to Va"...
function_definition (+198 nodes collapsed)
function_definition (+134 nodes collapsed)
function_definition
template_type
type_identifier "vector"
template_argument_list
< "<"
type_descriptor
primitive_type "double"
> ">"
function_declarator (+21 nodes collapsed)
compound_statement
{ "{"
if_statement
if "if"
condition_clause
( "("
unary_expression
! "!"
call_expression
field_expression
identifier "_spilledSortedSegments"
. "."
field_identifier "empty"
argument_list
( "("
) ")"
) ")"
compound_statement
{ "{"
comment "// We've exceeded the memory limit and spilled some data to "...
comment "// might still be data in _accumulatedValues that was incorp"...
comment "// not enough to hit the limit and spill again. So that we d"...
comment "// the algorithm to spill again here so that all of the data"...
expression_statement
call_expression
identifier "spill"
argument_list
( "("
) ")"
; ";"
declaration
qualified_identifier
namespace_identifier "std"
:: "::"
template_type
type_identifier "function"
template_argument_list
< "<"
type_descriptor
primitive_type "int"
abstract_function_declarator
parameter_list
( "("
parameter_declaration
type_qualifier
const "const"
type_identifier "Value"
abstract_reference_declarator
& "&"
, ","
parameter_declaration
type_qualifier
const "const"
type_identifier "Value"
abstract_reference_declarator
& "&"
) ")"
> ">"
init_declarator (+55 nodes collapsed)
; ";"
comment "// Initializes _sorterIterator as a MergeIterator that merge"...
comment "// segments of data together so that values can be iterated "...
expression_statement (+31 nodes collapsed)
expression_statement
assignment_expression
identifier "_indexNextSorted"
= "="
number_literal "0"
; ";"
comment "// Since we're reading one value from disk at a time, we com"...
comment "// ascending order but we still return the results in the or"...
declaration (+22 nodes collapsed)
declaration (+22 nodes collapsed)
expression_statement (+29 nodes collapsed)
comment "// Sort the indices in ascending order by their correspondin"...
expression_statement (+68 nodes collapsed)
for_range_loop (+34 nodes collapsed)
return_statement
return "return"
identifier "pctls"
; ";"
} "}"
if_statement (+34 nodes collapsed)
declaration
template_type
type_identifier "vector"
template_argument_list
< "<"
type_descriptor
primitive_type "double"
> ">"
identifier "pctls"
; ";"
expression_statement
call_expression
field_expression
identifier "pctls"
. "."
field_identifier "reserve"
argument_list
( "("
call_expression
field_expression
identifier "ps"
. "."
field_identifier "size"
argument_list
( "("
) ")"
) ")"
; ";"
comment "// When sufficiently many percentiles are requested at once,"...
comment "// the data rather than compute each percentile separately. "...
comment "// the size of the data and the number of percentiles, but t"...
comment "// we only consider the latter."
if_statement (+73 nodes collapsed)
for_range_loop (+29 nodes collapsed)
return_statement
return "return"
identifier "pctls"
; ";"
} "}"
} "}"
comment "// namespace mongo"

After

translation_unit
comment "/**\n * Copyright (C) 2024-present MongoDB, Inc.\n *\n * "...
preproc_include
#include "#include"
string_literal
" "\""
string_content "mongo/db/pipeline/percentile_algo_accurate.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "mongo/db/query/query_execution_knobs_gen.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "mongo/db/query/query_integration_knobs_gen.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "mongo/db/query/query_optimization_knobs_gen.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "mongo/db/sorter/file_based_spiller.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "mongo/db/sorter/sorter_template_defs.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "mongo/platform/atomic_word.h"
" "\""
preproc_include
#include "#include"
system_lib_string "<algorithm>"
preproc_include
#include "#include"
system_lib_string "<cmath>"
namespace_definition
namespace "namespace"
namespace_identifier "mongo"
declaration_list
{ "{"
using_declaration
using "using"
qualified_identifier
namespace_identifier "std"
:: "::"
identifier "vector"
; ";"
comment "/**\n * Generates a new file name on each call using a static"...
namespace_definition (+57 nodes collapsed)
comment "// namespace"
function_definition (+76 nodes collapsed)
function_definition (+334 nodes collapsed)
function_definition (+106 nodes collapsed)
function_definition (+38 nodes collapsed)
comment "/*\n * Serialize data currently in algorithm by casting to Va"...
function_definition (+198 nodes collapsed)
function_definition (+134 nodes collapsed)
function_definition
template_type
type_identifier "vector"
template_argument_list
< "<"
type_descriptor
primitive_type "double"
> ">"
function_declarator (+21 nodes collapsed)
compound_statement
{ "{"
if_statement
if "if"
condition_clause
( "("
unary_expression
! "!"
call_expression
field_expression
identifier "_spilledSortedSegments"
. "."
field_identifier "empty"
argument_list
( "("
) ")"
) ")"
compound_statement
{ "{"
comment "// We've exceeded the memory limit and spilled some data to "...
comment "// might still be data in _accumulatedValues that was incorp"...
comment "// not enough to hit the limit and spill again. So that we d"...
comment "// the algorithm to spill again here so that all of the data"...
expression_statement
call_expression
identifier "spill"
argument_list
( "("
) ")"
; ";"
declaration
placeholder_type_specifier
auto "auto"
init_declarator (+55 nodes collapsed)
; ";"
comment "// Initializes _sorterIterator as a MergeIterator that merge"...
comment "// segments of data together so that values can be iterated "...
expression_statement (+31 nodes collapsed)
expression_statement
assignment_expression
identifier "_indexNextSorted"
= "="
number_literal "0"
; ";"
comment "// Since we're reading one value from disk at a time, we com"...
comment "// ascending order but we still return the results in the or"...
declaration (+22 nodes collapsed)
declaration (+22 nodes collapsed)
expression_statement (+29 nodes collapsed)
comment "// Sort the indices in ascending order by their correspondin"...
expression_statement (+68 nodes collapsed)
for_range_loop (+34 nodes collapsed)
return_statement
return "return"
identifier "pctls"
; ";"
} "}"
if_statement (+34 nodes collapsed)
declaration
template_type
type_identifier "vector"
template_argument_list
< "<"
type_descriptor
primitive_type "double"
> ">"
identifier "pctls"
; ";"
expression_statement
call_expression
field_expression
identifier "pctls"
. "."
field_identifier "reserve"
argument_list
( "("
call_expression
field_expression
identifier "ps"
. "."
field_identifier "size"
argument_list
( "("
) ")"
) ")"
; ";"
comment "// When sufficiently many percentiles are requested at once,"...
comment "// the data rather than compute each percentile separately. "...
comment "// the size of the data and the number of percentiles, but t"...
comment "// we only consider the latter."
if_statement (+73 nodes collapsed)
for_range_loop (+29 nodes collapsed)
return_statement
return "return"
identifier "pctls"
; ";"
} "}"
} "}"
comment "// namespace mongo"