DeltaSort: Incremental Sorting of Arrays with Known Updates
Abstract
When records need to be read in a particular order, sorting at query time incurs repeated cost for an array of records and can become a bottleneck in read-heavy workloads. A common solution is to maintain a derived sorted read-replica that is kept updated as the underlying system-of-record changes. For updating read-replicas that are stored as arrays, existing approaches rely on either full re-sorting or incremental algorithms such as binary insertion or merge-based sort. In this paper, we study incremental sorting under a new model in which the sorting routine is explicitly informed of the indices updated since the previous sort – a setting that naturally arises in systems that track updates. Under this model, we present DeltaSort, a new algorithm that runs in expected time using auxiliary space under a random update model, and outperforms existing algorithms for small update batches in our experimental evaluation.
Keywords and phrases:
Incremental sorting, Sorting algorithms, Array maintenance2012 ACM Subject Classification:
Theory of computation Sorting and searching ; Theory of computation Data structures design and analysisSupplementary Material:
Software (Source Code): https://github.com/shudv/deltasort [13]archived at
swh:1:dir:bf69484c0b9a682ec1aac98197b5df0a554ed4a3
Editors:
Martin Aumüller and Irene FinocchiSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
Sorting is among the most heavily optimized primitives in modern systems, backed by decades of deep research. Standard library implementations – TimSort [4], Introsort [26], and DriftSort [8] deliver excellent performance for general inputs by exploiting existing order, cache locality, and adaptive strategies. However, these algorithms operate under a blind model: they discover structure dynamically rather than being explicitly informed about which values have been updated since the previous sort. While this model is more general and makes things straightforward for the caller, it also misses opportunities for optimization when such information is available. Modern systems often maintain metadata about updated records as part of their execution pipeline [22], making it possible to expose this information to lower-level sorting primitives. In the absence of a primitive that can accept this as a first-class input, they must either perform a full re-sort or use standard insertion-based or merge-based incremental algorithms.
As a concrete example, consider a client application displaying a large dynamic sorted list (e.g., a task manager or interactive dashboard). Such applications have tight latency budgets [16, 10], and UI frameworks encourage memoization to avoid recomputing expensive derived values [29]. However, memoization is typically coarse-grained: any change invalidates the cache and forces a full re-sort [16, 15]. An update-aware sorting primitive could restore order incrementally, avoiding this overhead.
Once the indices of the updates are known, how do we exploit this extra information to restore order more efficiently than performing a full re-sort? While similar questions arise for a variety of ordered data structures (e.g., B-Trees, heaps, and BSTs), in this paper we deliberately focus on arrays, which provide a contiguous memory layout. This choice is intentional: arrays remain the dominant representation for sorted data in performance-critical systems because they offer superior cache locality and enable SIMD/vectorized processing [20] – benefits that pointer-based structures fundamentally cannot provide. As a result, many systems prefer to preserve array layouts even when updates are frequent, rather than switching to fully dynamic structures [12, 1, 9]. This also allows us to cleanly isolate the algorithmic consequences of exposing update indices to the sorting routine and study the resulting trade-offs in a concrete setting.
| Algorithm | Time (Expected / Worst) | Space |
|---|---|---|
| Binary-Insertion-Sort† | ||
| Extract–Sort–Merge∗† | ||
| DeltaSort∗ |
= array size, = number of updates
∗These use a sort primitive internally, assumed to run in time.
†These have the same expected and worst-case time complexity.
Given an array of size , with updates, existing algorithms fall into two broad categories:
-
1.
Insertion-based: Each updated value is inserted into its correct position one by one. We use Binary-Insertion-Sort (BIS) as a representative of this category, which uses binary search to find the correct position for each updated value. This approach uses only auxiliary space but incurs data movement, making it suitable only when .
-
2.
Merge-based: Updated values are extracted into a separate buffer, sorted using an efficient algorithm, and then merged back into the original array. We use Extract–Sort–Merge (ESM) as a representative of this category, which compacts the unchanged elements and merges the updated values from the back. It runs in time using only space, but always touches the whole array irrespective of .
The optimal strategy is therefore: use BIS when , ESM otherwise. This raises the question: are there algorithms that can outperform BIS and ESM for practically relevant workloads? In this paper, we introduce such an algorithm. Specifically, this paper makes the following contributions:
-
1.
Update-aware sorting model: We formulate a sorting model in which the sorting routine is explicitly informed of the updated indices since the previous sort. Under this model, BIS and ESM are the best known baseline algorithms111Other potential baselines either reduce to trivial combinations of BIS and ESM, or rely on in-place merge algorithms [24] that do not naturally fit our problem model. We evaluated multiple baselines and picked the best-performing ones (see source repository [13] for benchmarks). that naturally exploit knowledge of which indices have been updated.
-
2.
DeltaSort algorithm: We present DeltaSort, an update-aware insertion-based sorting algorithm that reduces data movement by identifying segments – independent regions of the array – and restricting movement within them.
-
3.
Theoretical analysis: Under a random bounded-range update model, we show that DeltaSort achieves expected time complexity using auxiliary space.
-
4.
Experimental validation: We benchmark Rust implementations of DeltaSort, BIS, and ESM on synthetic datasets. In our evaluation, DeltaSort is the fastest algorithm for small update batches ( for ), which is the most practically relevant range for incremental workloads.
2 Related Work
Adaptive sorting algorithms exploit existing order in the input to improve performance on nearly sorted data. TimSort [4], DriftSort [8], and natural mergesort [23] dynamically identify monotonic runs and merge them efficiently, while a substantial body of work formalizes measures of presortedness and analyzes sorting complexity as a function of these measures rather than input size alone [25]. These approaches, however, assume no explicit knowledge of which values have been updated.
Incremental view maintenance (IVM) is a fundamental and deeply researched problem, where updates to input data are propagated to derived results using explicit delta representations [19, 30, 3, 5]. These techniques focus on maintaining query results, indexes, aggregates, and materialized views, and operate at the higher level of relational or dataflow operators rather than array-based sorting primitives. They treat deltas as first-class citizens and demonstrate the practical value of update-aware computation. However, they do not specifically address the lower-level problem of incrementally sorting arrays.
Partial sorting is another important problem where sorted output is read incrementally to avoid sorting everything upfront [11, 27]. This is a different model that addresses efficient selection rather than maintaining a fully sorted array under updates at all times.
Dynamic data structures offer a different trade-off. Self-balancing trees such as AVL trees [2], red–black trees [18], B-trees [6], and skip lists [28] support efficient ordered updates with logarithmic cost, but they do not preserve the contiguous layout and its associated advantages [12, 1, 9]. A related idea is “library sort” [7], which accelerates repeated insertions by maintaining gaps and hence does not preserve strictly contiguous layout by design.
In-place merging algorithms focus on merging two sorted arrays without using auxiliary space [24, 21]. While there is some conceptual overlap with DeltaSort in the nature of implementation, both the problem model and the goal differ. In-place merging assumes both input arrays are already sorted and aims for space usage, whereas DeltaSort deals with a sorted array where some values have been updated and can be arbitrarily interspersed within the array, and the aim is to offer a practical alternative to existing algorithms.
Overall, this work focuses on a more specialized (but fundamental) problem: maintaining sorted order in contiguous arrays after a batch of in-place updates, under the assumption that the indices of updated values are explicitly available. This setting is not addressed by adaptive sorting algorithms, system-level incremental indexing techniques, selection-based partial sorting algorithms, or in-place merging algorithms. DeltaSort operates as a low-level sorting primitive that complements higher-level incremental systems while preserving the cache locality of array-based layouts. To our knowledge, this sorting model has not been previously studied.
3 Problem Model
Definition 1 (Update-Aware Sorting).
Let be an array of size that is initially sorted according to a strict weak ordering induced by a comparator cmp. Let be a set of distinct indices such that the values at indices in may have been arbitrarily updated222This model can be easily extended to insertions and deletions as well. Insertions can be handled by appending the new value to the end of the array and adding to . Deletions can be reduced to updates by assigning a sentinel value larger than all existing values and truncating the array after sorting., while values at all other indices remain unchanged. The update-aware sorting problem is to restore the global sorted order of with respect to cmp, given explicit knowledge of the update set .
The sorting primitive in this model requires the caller to store the updated indices, incurring an extra space overhead compared to full re-sorting. This overhead is modest and aligns with how updates are applied in practice: locating and updating a value already requires identifying its position, and recording that position incurs only constant additional cost per update. In contrast, avoiding this bookkeeping typically forces the system to fall back to either full re-sorting, which incurs time cost per update, or BIS, which incurs data movement cost per update. Modern streaming and stateful processing systems [22] routinely track update deltas as part of their execution pipelines, making the update-aware model a natural and practically useful abstraction.
4 DeltaSort Algorithm
DeltaSort is an insertion-based update-aware sorting algorithm. Below, we first give an overview of the algorithm, then formally prove its correctness, and finally analyze its expected complexity under a random update model.
4.1 Overview
DeltaSort operates in two phases (see Algorithm 1 for pseudocode and Figure 2 for an example). The first phase establishes a structure among updated values, and the second phase exploits this structure to efficiently sort the array.
Phase 1: Establish structure
DeltaSort begins by extracting the values at the updated indices, sorting them (e.g., via indirect heapsort using the index list as indirection), and writing them back into the array in increasing index order. This step enforces order among updated indices: if are both updated indices, then (according to cmp) after Phase 1. The unchanged values are already in order by design. Hence, any remaining order violations must occur only between updated values and their unchanged neighbors.
Phase 2: Fix violations
With the above structure in place, DeltaSort fixes the array one updated index at a time left to right. When an updated index is first encountered, we first determine its direction:
Definition 2 (Direction).
During Phase 2, for an index , we define its direction based on its local order with its left neighbor:
-
1.
LEFT (): Value is ordered incorrectly to its left neighbor and hence must move left:
-
2.
RIGHT (): Value is ordered correctly to its left neighbor or it is the first value and hence may move right:
A few important things to note about this definition:
-
Direction captures on which side of its current position the target of an updated index lies. Hence, direction is not defined (or needed) for unchanged indices ().
-
The definition of direction is asymmetric. requires a strict violation (), while includes both violating and non-violating cases, as it may or may not violate order with its right neighbor. This is deliberate because DeltaSort treats all values identically, so combining these cases simplifies the implementation (see Algorithm 1).
Phase 2 (lines 9–29) processes updated indices from left to right while maintaining a growing sorted prefix. We describe Phase 2 by first establishing a loop invariant and then proving its correctness by showing that the loop invariant holds at initialization, is preserved during maintenance, and that the array is fully sorted at termination.
State
We utilize the following state information during Phase 2:
-
updatedIndices: Sorted list of updated indices with a sentinel appended at the end.
-
: The boundary of the sorted prefix, at the start.
-
pendingRight: Stack of pending indices, empty at the start.
Loop invariant
At the start of each iteration of the loop at line 10, the following conditions hold for the current index :
-
1.
The subarray is sorted.
-
2.
There are no violations in the range .
-
3.
The stack contains pending indices within the range .
-
4.
If the previous updated index had direction, then pendingRight is empty.
Initialization
The invariant trivially holds before the first iteration ().
Maintenance
We will now show that if the invariant holds for , it also holds for the next updated index. Let dir denote the direction of .
Case 1: .
-
1.
We first set . This marks the right boundary beyond which the values in pendingRight cannot move, because after Phase 1, updated values are ordered and hence cannot cross each other in either direction.
-
2.
We then flush all pending indices in LIFO order. Each index is fixed by binary insertion within the range , where is advanced leftward after each fix to ensure that we search within a minimal range for maximum efficiency. By construction, the range contains no violations, so binary search finds the correct insertion point. This step preserves conditions (3) and (4) of the loop invariant.
-
3.
After all s are fixed, we fix the current index by binary insertion within . This range also contains no violations because all violations are already fixed in the step above, and by invariant condition (2), this range contained no violations to begin with. Finally, we set (insertion point of ) (not needed for correctness, but reduces the search range). This preserves conditions (1) and (2) of the loop invariant.
Case 2: .
-
1.
If pendingRight is empty, this is the first in a new segment, so we set . This preserves conditions (1) and (2) of the loop invariant.
-
2.
We then push onto pendingRight for deferred fixing. This preserves conditions (3) and (4) of the loop invariant.
Termination
The loop processes all values of updatedIndices, including the sentinel index , which is treated as . Substituting in the invariant conditions, we have:
-
Condition (1) implies that is sorted and contains its final values.
-
Condition (2) implies there are no violations in the range .
-
Conditions (3) and (4) together imply that there are no violations in the range .
-
Hence we can conclude that the array is fully sorted.
Figure 2 illustrates this sequence of operations for a sample array.
It is important to note that even though we are doing repeated binary insertions for fixing violations, the overall data movement is reduced as compared to naive independent binary insertions because the binary search range is smaller. To formalize this we need to understand the structure that emerges from Phase 1. If we picture the updated indices arranged in a sequence of and labels, based on their direction when first encountered during Phase 2, we can partition them into segments.
Definition 3 (Segment).
A segment is a subarray of spanning indices , where , such that:
-
1.
Either , or and has direction label .
-
2.
Either , or and has direction label .
-
3.
There exist no updated indices with such that is and is .
-
4.
There exist no updated indices and such that is also a segment.
More intuitively, a segment is a maximal contiguous region of the array in which all -direction updates precede all -direction updates. The first two conditions define valid segment boundaries, the third enforces the structure within a segment, and the final condition ensures that segments are maximal and non-overlapping. Figure 3 illustrates this structure.
Key Insight: Segments can be fixed locally and independently
Unlike naive BIS, where each insertion can be at any point in the array, in DeltaSort, an updated value in a segment cannot cross its segment boundary. We formally prove this property next.
Lemma 4 (Movement Confinement).
During Phase 2, all value movement is confined within segment boundaries.
Proof.
Let be a segment with -indices followed by -indices , where . After Phase 1, updated values are ordered: . An -value cannot have crossed (if it exists), and an -value cannot have crossed (if it exists), since the above ordering must be preserved. Therefore, no value exits its segment.
Remark 5.
Note that Lemma 4 also implies segment independence. Because no value exits its segment, segment lengths do not change. As a result, movement in a segment does not interfere with movement in another segment, which implies segments can be fixed independently in any order. This opens opportunities for parallelization, where segments could be fixed concurrently. We leave this investigation to future work.
4.2 Complexity Analysis
We analyze the expected total data movement incurred during Phase 2 of DeltaSort under a random bounded-range update model. In this model, updated values are drawn uniformly at random from a fixed value range. Choosing values at random avoids introducing any special structure that could bias the analysis.
Remark 6 (Choice of Update Model).
Several update models could be considered. For example, a bounded-rank displacement model constrains updates such that for every updated value for some bound , while a clustered update model restricts updated indices to a region with . Different models interact with DeltaSort’s structure in different ways: bounded-rank displacement directly limits movement and is therefore favorable, whereas clustered updates may either help or hinder performance depending on the induced directional pattern. In this work, we adopt the random bounded-range update model as a neutral baseline. Specifically, updated indices are chosen uniformly at random from , and updated values are drawn independently from a fixed range of permissible values. This model introduces no additional structure that the algorithm can exploit, nor does it adversarially bias updates toward worst-case configurations (see Figure 4 for an illustration). Analyzing DeltaSort under more structured update models is left to future work.
Lemma 7 (Expected Movement).
Under the random bounded-range update model, for an array of size with updated indices, the expected total data movement incurred during DeltaSort’s Phase 2 is .
Proof.
After Phase 1, we have two sorted sequences of values each:
-
Indices: The updated positions , sorted.
-
Values: The updated values , sorted.
Phase 1 pairs these by rank: the -th smallest value is placed at the -th smallest index . Since both indices and values are drawn uniformly at random, each sorted sequence forms an order statistic of uniform samples.
Although values may be drawn from a different range than indices, what matters for determining direction is the value’s target position – where it belongs in the final sorted array. For a value in a sorted array of values spanning range , its target position is approximately . Since is uniform over , the target position is uniform over – the same range as the indices. Thus, we can analyze both sequences as order statistics of uniform samples from the same range.
Define the gap at rank as:
This measures how far ahead (positive) or behind (negative) the value’s target position is relative to its current position. By Definition 2:
-
implies the value is too small for its position, so direction is .
-
implies the value is adequate or too large, so direction is .
The gap evolves as we move through the ranks. Let and denote the spacings between consecutive order statistics. The change in gap is:
Since both and are spacings of independent uniform order statistics, they have the same expected value () and are independent of each other. Therefore, the increment has mean zero and behaves as a random step. This means the sequence evolves as a symmetric random walk.
By Definition 3, segment boundaries occur at transitions – precisely when the gap crosses from negative to non-negative. This corresponds to an upcrossing of zero in the random walk. A classical result from random walk theory [14] states that a symmetric random walk of steps has expected number of zero crossings . Since transitions account for roughly half of all zero crossings, the expected number of segments is .
With segments partitioning the array of size , the expected width of each segment is . By Lemma 4, movement is confined within segments. Since each of the updated values moves at most the width of its containing segment, the expected total movement is:
Remark 8 (Worst Case Movement).
While the expected movement is , the worst-case movement is . This occurs when updated values form a single segment spanning the entire array. This happens when updates cluster monotonically at the start or end of the array (see Figure 4). Hence, in a practical setting, a hybrid algorithm will need to fall back to ESM or full re-sort based on the number of segments.
Lemma 9 (Comparison Count).
DeltaSort performs comparisons.
Proof.
Phase 1 sorts the updated values, requiring comparisons. In Phase 2, each updated value is fixed using binary search within its containing segment. As shown in the proof of Lemma 7, the expected number of segments is , so the expected width of a segment is . Since searches are confined within segment boundaries, each fix requires comparisons, for a total of comparisons in Phase 2. Summing both gives:
Theorem 10 (Time Complexity).
DeltaSort runs in expected time.
Proof.
By Lemma 7, the expected total data movement is . By Lemma 9, the total number of comparisons is . Phase 1 also contributes movement for sorting values. Since for , the total is .
Theorem 11 (Space Complexity).
DeltaSort uses auxiliary space.
Proof.
Phase 1 sorts values using space. Phase 2 maintains a pending stack of at most indices. Therefore, the total auxiliary space is .
4.3 Empirical Validation
Figure 5 presents empirical validation of DeltaSort’s complexity bounds across multiple scales of and . For movement complexity, we normalize the measured movement by ; for comparison complexity, we normalize by . If the theoretical bounds are tight, these normalized values should be approximately constant across all scales.
The results confirm both bounds: movement normalized by converges to approximately across four orders of magnitude of , and comparisons normalized by converge to approximately . The overlap of curves for different validates that the asymptotic analysis correctly captures the algorithm’s behavior.
5 Experimental Evaluation
All benchmarks are run on Rust implementations of each algorithm on randomly generated synthetic datasets of user objects (name, age, country) on an Apple M3 Pro chip. We chose Rust due to its predictable performance characteristics333In contrast, managed-runtime environments like JavaScript on V8 are affected by garbage collection, non-contiguous memory layouts [17], etc.. We used a realistic multi-key comparator to simulate a practical workload. Execution times are measured after sufficient warm-up, and each data point is the mean over repeated runs with 95% CI within . All source code, along with an extensive suite of randomized correctness tests, is available for reproducibility [13].
We evaluated the following algorithms:
-
FullSort: Rust’s slice::sort_by implementation based on DriftSort [8], representing full re-sorting of the array. This serves as a critical baseline to identify the crossover threshold for each update-aware algorithm beyond which FullSort is preferable. We deliberately choose the adaptive stable sort over sort_unstable_by because DriftSort detects existing sorted runs, making it a stronger baseline for nearly-sorted inputs.
-
BIS and ESM: Standard baseline algorithms as defined in Section 1. ESM uses Rust’s unstable sort for sorting the updated values.
-
DeltaSort: Standard implementation as described in Section 4. Sorts updated values using Rust’s unstable sort, then fixes violations using binary search and rotation.
5.1 Results
Figure 6(a) shows execution time (in µs) for K values as a function of percentage of updated values on a log–log scale. We use a log–log scale to highlight interesting behavior at lower ranges of , which is the most practically relevant range, since updates typically affect only a small fraction of an array at once. As increases, all update-aware algorithms eventually lose to FullSort at their crossover threshold , as the overhead of processing updates overshadows any benefit from knowing what was updated. Figure 6(b) shows how varies for each algorithm across various scales. Several observations emerge:
-
1.
The asymptotic behavior for each algorithm aligns with theory. BIS exhibits steep growth consistent with its movement cost, quickly becoming impractical as increases. ESM is relatively flat for small , where its linear merge pass dominates. DeltaSort exhibits sublinear growth consistent with its expected movement.
-
2.
DeltaSort is the fastest algorithm for . For example, at , DeltaSort is 13 faster than FullSort, 2.5 faster than ESM, and 18 faster than BIS. Even though is small in absolute terms, it aligns very well with practical workloads where updates usually affect only a small percentage of the full dataset.
-
3.
ESM is unsurprisingly the fastest algorithm across the intermediate range (), where its linear merge pass is most efficient.
-
4.
Crossover thresholds for ESM and DeltaSort are high and largely consistent across the scales we tested, while BIS’s crossover thresholds drop rapidly as array size increases. This shows that even though DeltaSort is insertion-based like BIS, it is able to leverage the segment structure to achieve high thresholds. On the other hand, DeltaSort–ESM crossover drops as array size increases, indicating that as array sizes get larger, the range of for which DeltaSort is the fastest algorithm narrows.
These observations also suggest that, much like hybrid blind sorting algorithms (e.g., TimSort [4], DriftSort [8]), it would be beneficial to construct adaptive update-aware strategies. As an example, for the Rust implementation evaluated here, a simple adaptive strategy could be: use DeltaSort for , ESM for , and FullSort for . The optimal crossover thresholds depend on factors such as update distribution and comparator cost. For example, as the comparator cost grows, DeltaSort preserves its advantage over BIS because both have similar comparison count: , while widening its gap relative to ESM444We also tested a binary-search-based variant of ESM that has lower comparison overhead but does not achieve the fastest execution time overall (see source repository [13])., which has much higher comparison overhead. Hence, the crossover thresholds would shift in favor of DeltaSort, expanding the range of for which it is the fastest algorithm.
5.2 Performance in V8 runtime
DeltaSort was also implemented in JavaScript [13] and benchmarked on V8 against the native Array.prototype.sort to evaluate behavior in a runtime that does not have a predictable data movement cost model [17]. The key takeaways are (see Appendix A for full benchmarks):
-
1.
DeltaSort performs similarly to BIS and has lower crossover thresholds than in Rust, indicating that the asymptotic improvement seen in Rust is lost in V8.
-
2.
ESM is 1.5 faster than FullSort for up to 50%, indicating that even in managed runtimes, exposing updated indices can unlock better incremental sort performance.
6 Conclusion
In this paper, we studied the problem of maintaining sorted arrays under incremental known updates. We argued that this update-aware setting arises naturally in many practical systems. Within this model, we presented DeltaSort, an incremental sorting algorithm that batches multiple updates instead of applying them independently. The key idea is to exploit structure created by pre-sorting updated values, which induces segments and enables localized, non-overlapping fixes. This enables DeltaSort to reduce redundant data movement. Our theoretical analysis shows that DeltaSort matches the comparison efficiency of BIS while exhibiting data movement under the random bounded-range update model. Experimental results in Rust demonstrate that DeltaSort outperforms both BIS and ESM for small update batches, which is the most practically relevant operating range for incremental workloads. For larger update batches, ESM’s linear merge pass becomes preferable. To stress-test the underlying cost assumptions, we also evaluated DeltaSort in the V8 runtime, where data movement costs are less predictable. In this setting, DeltaSort and BIS perform similarly and exhibit much lower crossover thresholds than in Rust, highlighting that DeltaSort’s full complexity advantage depends on execution environments with predictable and contiguous memory layouts.
More broadly, this work suggests that when update metadata is already available, sorting primitives need not discover structure dynamically. By extending update-awareness down to low-level ordering primitives, we open a new space of algorithmic trade-offs beyond what blind sorting algorithms can achieve.
7 Future Work
While our analysis focuses on a random bounded-range update model, many practical workloads exhibit additional structure. Examples include bounded-rank or clustered updates. These models may improve or worsen the movement and comparison costs of DeltaSort, potentially impacting the range in which it is applicable. Hence, a more systematic study of such update models is important.
Additionally, we showed how segments can be fixed locally and independently. This strongly suggests opportunities for parallel execution, where different segments could be fixed concurrently without interference. In contrast, BIS is inherently sequential due to overlapping in-place shifts. Exploring the parallel variant of DeltaSort and understanding its scalability on multi-core systems is a promising direction for future work.
None of the incremental algorithms studied here (BIS, DeltaSort, ESM) guarantee stability. The impact of guaranteeing stability on the performance and complexity of update-aware algorithms remains to be studied.
Finally, while this paper treats DeltaSort as a standalone algorithm for analysis, practical systems would benefit from adaptive update-aware strategies that select among BIS, DeltaSort, ESM, and full re-sorting based on the update batch size and system constraints. Designing heuristic-based, low-overhead mechanisms for such dynamic selection is an open challenge.
References
- [1] Daniel J. Abadi, Samuel R. Madden, and Nabil Hachem. Column-stores vs. row-stores: how different are they really? In Proceedings of the 2008 ACM SIGMOD International Conference on Management of Data, SIGMOD ’08, pages 967–980, New York, NY, USA, 2008. Association for Computing Machinery. doi:10.1145/1376616.1376712.
- [2] Georgy M. Adelson-Velsky and Evgenii M. Landis. An algorithm for the Organization of Information. Proceedings of the USSR Academy of Sciences, 146:263–266, 1962.
- [3] Tyler Akidau, Robert Bradshaw, Craig Chambers, Slava Chernyak, Rafael J. Fernández-Moctezuma, Reuven Lax, Sam McVeety, Daniel Mills, Frances Perry, Eric Schmidt, and Sam Whittle. The dataflow model: a practical approach to balancing correctness, latency, and cost in massive-scale, unbounded, out-of-order data processing. Proc. VLDB Endow., 8(12):1792–1803, August 2015. doi:10.14778/2824032.2824076.
- [4] Nicolas Auger, Vincent Jugé, Cyril Nicaud, and Carine Pivoteau. On the worst-case complexity of TimSort. In Proceedings of the 26th Annual European Symposium on Algorithms (ESA), pages 4:1–4:13, 2018. doi:10.4230/LIPIcs.ESA.2018.4.
- [5] Ahmet Arif Aydin and Kenneth M. Anderson. Incremental sorting for Large Dynamic Data Sets. In 2015 IEEE First International Conference on Big Data Computing Service and Applications, pages 170–175, 2015. doi:10.1109/BigDataService.2015.35.
- [6] R. Bayer and E. McCreight. Organization and maintenance of large ordered indices. In Proceedings of the 1970 ACM SIGFIDET (Now SIGMOD) Workshop on Data Description, Access and Control, SIGFIDET ’70, pages 107–141, New York, NY, USA, 1970. Association for Computing Machinery. doi:10.1145/1734663.1734671.
- [7] Michael A. Bender, Martin Farach-Colton, and Miguel A. Mosteiro. Insertion sort is . CoRR, cs.DS/0407003, 2004. doi:10.48550/arXiv.CS/0407003.
- [8] Lukas Bergdoll. driftsort: an efficient, generic and robust stable sort implementation. https://github.com/Voultapher/driftsort, 2023. Accessed: 2026-01-10.
- [9] Peter A. Boncz, Marcin Zukowski, and Niels Nes. MonetDB/X100: Hyper-Pipelining query execution. In 2nd Biennial Conference on Innovative Data Systems Research (CIDR), 2005. URL: http://cidrdb.org/cidr2005/papers/P19.pdf.
- [10] Stuart K. Card, Thomas P. Moran, and Allen Newell. The Psychology of Human-Computer Interaction. Lawrence Erlbaum Associates, 1983.
- [11] John M. Chambers. Algorithm 410: Partial Sorting. Communications of the ACM, 14(5):357–358, 1971. doi:10.1145/362588.362591.
- [12] Ulrich Drepper. What every programmer should know about memory. https://people.freebsd.org/˜lstewart/articles/cpumemory.pdf, 2007.
- [13] Shubham Dwivedi. DeltaSort: Reference implementation and benchmarks. https://github.com/shudv/deltasort, 2026. Rust and JavaScript implementations with unit tests and benchmark suite.
- [14] William Feller. An Introduction to Probability Theory and Its Applications, volume 1. Wiley, 3rd edition, 1968.
- [15] Google Chrome Team. The rail performance model. https://web.dev/rail/, 2015.
- [16] Google Chrome Team. Interaction to next paint (inp). https://web.dev/articles/inp, 2023. Accessed: 2026-01-10.
- [17] Google V8 Team. Elements kinds in V8. https://v8.dev/blog/elements-kinds, 2017.
- [18] Leo J. Guibas and Robert Sedgewick. A dichromatic framework for balanced trees. In 19th Annual Symposium on Foundations of Computer Science (sfcs 1978), pages 8–21, 1978. doi:10.1109/SFCS.1978.3.
- [19] Ashish Gupta and Inderpal Singh Mumick. Maintenance of materialized views: problems, techniques, and applications, pages 145–157. MIT Press, Cambridge, MA, USA, 1999.
- [20] John L. Hennessy and David A. Patterson. Computer Architecture: A Quantitative Approach. Morgan Kaufmann, 6 edition, 2017.
- [21] Bing-Chao Huang and Michael A. Langston. Practical in-place merging. Commun. ACM, 31(3):348–352, March 1988. doi:10.1145/42392.42403.
- [22] Martin Kleppmann. Designing Data-Intensive Applications. O’Reilly Media, 2017.
- [23] Donald E. Knuth. The Art of Computer Programming, Volume 3: Sorting and Searching. Addison-Wesley, 2nd edition, 1998.
- [24] M. A. Kronrod. Optimal ordering algorithm without operational field. Soviet Mathematics Doklady, 10:744–748, 1969.
- [25] Heikki Mannila. Measures of Presortedness and Optimal Sorting Algorithms. IEEE Transactions on Computers, C-34(4):318–325, 1985. doi:10.1109/TC.1985.5009382.
- [26] David R. Musser. Introspective sorting and selection algorithms. Software: Practice and Experience, 27(8):983–993, 1997. doi:10.1002/(SICI)1097-024X(199708)27:8<983::AID-SPE117>3.0.CO;2-\#.
- [27] Rodrigo Paredes and Gonzalo Navarro. Optimal incremental sorting. In 2006 Proceedings of the Eighth Workshop on Algorithm Engineering and Experiments (ALENEX), pages 171–182. SIAM, 2006. doi:10.1137/1.9781611972863.16.
- [28] William Pugh. Skip lists: a probabilistic alternative to balanced trees. Commun. ACM, 33(6):668–676, June 1990. doi:10.1145/78973.78977.
- [29] React Team. usememo. https://react.dev/reference/react/useMemo, 2024. Accessed: 2026-01-10.
- [30] Barbara G. Ryder and Marvin C. Paull. Incremental data-flow analysis algorithms. ACM Trans. Program. Lang. Syst., 10(1):1–50, January 1988. doi:10.1145/42192.42193.
Appendix A JavaScript/V8 Benchmarks
Both BIS and DeltaSort perform similarly and have rapidly declining crossover thresholds as increases. This indicates that V8’s data movement cost model does not provide any asymptotic advantage for DeltaSort. Hence, in V8, a valid adaptive strategy can be: use BIS/DeltaSort for , ESM for , Array.prototype.sort for .
Appendix B Raw Benchmark Data
Table 2 presents the raw execution time measurements for Rust benchmarks. Each row shows the mean execution time and 95% confidence interval as a percentage for a given value of .
| Iters | FullSort | % | BIS | % | ESM | % | DeltaSort | % | |||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| % | % | % | % | ||||||||||
| % | % | % | % | ||||||||||
| % | % | % | % | ||||||||||
| % | % | % | % | ||||||||||
| % | % | % | % | ||||||||||
| % | % | % | % | ||||||||||
| % | % | % | % | ||||||||||
| % | % | % | % | ||||||||||
| % | % | % | % | ||||||||||
| % | % | % | % | ||||||||||
| % | % | % | % | ||||||||||
| % | % | % | % | ||||||||||
| % | % | % | % | ||||||||||
| % | % | % | % | ||||||||||
| % | % | % | % | ||||||||||
| % | % | % | % | ||||||||||
