21 Algorithms and Complexity
Complexity appears in this corpus where it explains what a runtime does. R looks names up through a chain of environments, and every closure call puts a new environment at the front of the chain it searches. A mark-and-sweep collector’s marking work grows with the number of live objects. GNU R’s collector is generational, so a minor collection works on the younger generations only, and it frees unmarked nodes by resetting its free lists, not by visiting each one. Contention for shared data keeps speedup below linear. Big-O notation and amortized analysis come up inside those pages, next to the cost they explain.
Scope of this section
A bound on paper can miss what limits the real system. A scheduler’s cost depends on how often its workers touch shared state, and its complexity class does not show that. So the analysis sits next to the system it describes, and this page points to it.
Where this material lives instead
- Environment lookup and hash tables: Environments
- Garbage collection scaling: Garbage Collection
- Scheduler complexity and work stealing: Work Stealing
- Parallel speedup and contention: Concurrency