Skip to content

Commit

Permalink
Update sysbench_perf_degradation.md
Browse files Browse the repository at this point in the history
  • Loading branch information
wangbin579 committed Dec 2, 2024
1 parent ee32eac commit 9a5ce8e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions sysbench_perf_degradation.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,13 @@ pointer dereferences, compared to vector's indexed access which performs only on
The storage of a deque is automatically expanded and contracted as needed. Expansion of a deque is cheaper than the expansion
of a std::vector because it does not involve copying of the existing elements to a new memory location. On the other hand,
deques typically have large minimal memory cost; a deque holding just one element has to allocate its full internal array
(e.g. 8 times the object size on 64-bit libstdc++; 16 times the object size or 4096 bytes, whichever is larger, on 64-bit libc++).
(e.g. 8 times the object size on 64-bit libstdc++; 16 times the object size or 4096 bytes, whichever is larger, on 64-bit
libc++).
The complexity (efficiency) of common operations on deques is as follows:
Random access - constant O(1).
Insertion or removal of elements at the end or beginning - constant O(1).
Insertion or removal of elements - linear O(n).
```

As shown in the above description, in extreme cases, retaining a single element requires allocating the entire array, resulting in very low memory efficiency. For example, in bulk inserts, where a large number of records need to be inserted, the official implementation stores each record in a separate deque. Even if the record content is minimal, a deque must still be allocated. The MySQL deque implementation allocates 1KB of memory for each deque to support fast lookups.
Expand Down

0 comments on commit 9a5ce8e

Please sign in to comment.