C++ Con 2024: Amortized Complexity
1/32 Amortized O(1) Complexity Andreas Weis CppCon 20242/32 Runtime Complexity f ∈ O(g) ⇐⇒ ∃ C > 0. ∃ x0 > 0. ∀ x > x0 : |f (x)| ≤ C · |g(x)|3/32 Child’s play!4/32 What is amortized complexity?4/32 What is amortized complexity?4/32 What is amortized complexity?4/32 What is amortized complexity?4/32 What is amortized complexity?4/32 What is amortized complexity?4/32 What is amortized complexity complexity?5/32 Amortized Analysis Aggregate analysis Accounting method Potential method5/32 Amortized Analysis Aggregate analysis Accounting method Potential method6/32 Accounting6/32 Accounting7/320 码力 | 60 页 | 2.56 MB | 5 月前3Algorithmic Complexity
push_back to a vector well, we need to talk about Amortized Complexity 41 push_back Algorithmic Complexity @ CppCon 2021 Amortized Complexity Amortized complexity considers the total worst case complexity worst case O(n) then the amortized complexity is O(1) Example 2: If the total for n operations is in the worst case O(n2) then the amortized complexity is O(n) Note: Amortized complexity is NOT the average Tarjan, Robert Endre (April 1985). Amortized Computational Complexity 42Algorithmic Complexity @ CppCon 2021 (3) What is the Complexity of: push_back to a vector Amortized O(1) 43 push_back Algorithmic0 码力 | 52 页 | 1.01 MB | 5 月前3Back to Basics: Classic 9STL
Vector template> class vector; • Features • Supports amortized constant time insert and erase operations at its end • Supports linear time insert and erase operations Container: Deque template > class deque; • Features • Supports amortized constant time insert and erase operations at both ends • Supports linear time insert and erase = equal_to , class Allocator = allocator > class unordered_set; • Features • Supports amortized constant time element lookup • Elements of type Key are stored internally in an order determined 0 码力 | 75 页 | 603.36 KB | 5 月前3Taming the C++ Filter View
Guarantees for Views – Initialization has constant complexity – begin() has amortized constant complexity – end() has amortized constant complexity [range.range]: Given an expression t such that decltype((t)) T&, T models concept std::range only if ... (3.2) — both ranges::begin(t) and ranges::end(t) are amortized constant time and non-modifying, ... C++20: C++98/C++20 Nico Josuttis C++ Filter View @cppcon0 码力 | 43 页 | 2.77 MB | 5 月前3Lock-Free Atomic Shared Pointers Without a Split Reference Count? It Can Be Done!
protected pointers were announced45 Daniel Anderson -- danielanderson.net Amortized vs deamortized latency Amortized 1% 50% 99% 99.95% Load 24.8 n 16n 16n 31n 34n Store 29.8 n 19n 19n 34n 40n0 码力 | 45 页 | 5.12 MB | 5 月前3Back to Basics Almost Always Vector
elements in sequence is faster than containers like std::list, which have non-contiguous memory. Amortized Constant-Time Growth: When adding elements, std::vector resizes by allocating more memory in chunks capacity). Though resizing has a cost, this occurs infrequently, making most insertions run in amortized constant time. Ensuring adding elements is generally efficient. 59Practicality Automatic Memory0 码力 | 62 页 | 4.86 MB | 5 月前3When Nanoseconds Matter: Ultrafast Trading Systems in C++
AddOrder: log(N) • ModifyOrder: amortized constant - std::map iterators are stable, which means we can store it with our order data (in the hash table) • DeleteOrder: amortized constant - Same as aboveOrderBookMap0 码力 | 123 页 | 5.89 MB | 5 月前3Data Structures That Make Video Games Go Round
container: ● Pointer / iterator stability. ● Memory block reuse. ● O(1) on insert amortized. ● O(1) on erase amortized (regardless of location).Skipfields are used during iteration to skip empty blocks0 码力 | 196 页 | 3.03 MB | 5 月前3领域驱动设计&中台/Every Entity as A Microservice
����work�������� ���� • ������ � Accountable • ������ ��� Autonomous • ������ ������ ���� Amortized ���� => ���� => ���� �������� ����� ACCOUNTABLE Accountable������� ���� ����� �������� ���1���0 码力 | 87 页 | 4.02 MB | 1 年前3Interesting Upcoming Features from Low Latency, Parallelism and Concurrency
Protect object Use object Remove object Retire object Reclaim object Unprotect object < 1 ns amortized asynchronous ~ 0 nstemplate> class hazard_pointer_obj_base 0 码力 | 56 页 | 514.85 KB | 5 月前3
共 152 条
- 1
- 2
- 3
- 4
- 5
- 6
- 16
相关搜索词
C++Con2024AmortizedComplexityAlgorithmicBacktoBasicsClassic9STLTamingtheFilterViewLockFreeAtomicSharedPointersWithoutSplitReferenceCountItCanBeDoneAlmostAlwaysVectorWhenNanosecondsMatterUltrafastTradingSystemsinDataStructuresThatMakeVideoGamesGoRound领域驱动设计中台EveryEntityasMicroserviceInterestingUpcomingFeaturesfromLowLatencyParallelismandConcurrency