Overheads (2023)
a day ago
- #systems programming
- #hidden costs
- #performance
- Higher-level languages have hidden performance costs, such as garbage collector pauses, which are unacceptable for systems programming.
- Swift uses Copy on Write (CoW) to avoid expensive data copies, but this can still lead to hidden costs when modifying data.
- Unicode segmentation in Swift makes string indexing O(n) instead of O(1), which is not ideal for systems programming.
- C and C++ also have hidden costs like stack spilling and silent memcpy operations, but these are often considered negligible.
- The key factor in determining unacceptable hidden costs is time complexity; anything greater than O(1) should be visible in the source code.
- Systems programming languages should avoid overheads with time complexity greater than O(1) to maintain performance predictability.