Related Experiment Video
Updated: Apr 3, 2026

05:11
Tuning Degradation to Achieve Specific and Efficient Protein Depletion
Published on: July 20, 2019
6.7K
A Case Study of Performance Degradation Attributable to Run-Time Bounds Checks on C++ Vector Access
David Flater1, William F Guthrie1
1National Institute of Standards and Technology, Gaithersburg, MD 20899.
Journal of Research of the National Institute of Standards and Technology
|September 25, 2015
Summary
Adding run-time bounds-checking to C++ arrays incurs minimal performance degradation, averaging less than 1%. This suggests safety checks can be implemented without significant performance penalties, improving software security.
Area of Science:
- Computer Science
- Software Engineering
- Performance Optimization
Background:
- Programmers often disable run-time safety checks, such as array bounds checking, to avoid perceived performance impacts.
- This omission can lead to security vulnerabilities and software quality issues.
- Array index out-of-bounds errors are a common programming mistake.
Purpose of the Study:
- To quantify the performance overhead of implementing array bounds-checking in C and C++.
- To evaluate the performance penalty of two distinct bounds-checking implementations.
- To assess the feasibility of incorporating safety checks without compromising application speed.
Main Methods:
- A benchmark was designed featuring a loop that sequentially writes to array elements.
- Performance was measured on a modern desktop PC with a superscalar CPU.
- Two different bounds-checking implementations in C and C++ were tested and compared.
Main Results:
- A standard bounds-checking access method in C++ showed a mean performance degradation of only (0.881 ± 0.009)% compared to the fastest unchecked access.
- The performance penalty was minimal, suggesting that safety checks do not necessarily lead to significant slowdowns.
- The study highlights the low cost of implementing basic safety checks.
Conclusions:
- The performance cost of array bounds-checking is negligible in many common scenarios.
- This case study indicates that safety checks can be integrated into C++ applications without substantial performance loss.
- Further research is recommended across diverse use cases, languages, and environments to fully understand the trade-offs between performance, security, and software quality.
Related Concept Videos
Optimization Problems
184
Optimization problems often involve identifying maximum or minimum values under specific constraints. A well-known example is determining the longest horizontal pipe that can be moved around a right-angled corner, where a 3-meter-wide hallway meets a 2-meter-wide hallway. This scenario, common in architectural design and industrial transport, can be understood conceptually through geometric and trigonometric reasoning.To visualize the problem, consider the pipe as a straight line that touches...
184
Vector Operations
2.6K
Vectors are physical quantities that have both magnitude and direction. The vector operations include addition, subtraction, and scalar multiplication.
A vector multiplied by a scalar value is called scalar multiplication. The result obtained is a new vector with a different magnitude. If the scalar is positive, the direction of the vector remains the same, but if it is negative, the direction of the vector is reversed. For example, the product of the mass and velocity yields the momentum.
A vector multiplied by a scalar value is called scalar multiplication. The result obtained is a new vector with a different magnitude. If the scalar is positive, the direction of the vector remains the same, but if it is negative, the direction of the vector is reversed. For example, the product of the mass and velocity yields the momentum.
2.6K
Vectors
668
Vectors are mathematical entities characterized by both magnitude and direction. Unlike scalars, which are defined solely by magnitude, vectors represent quantities like displacement, velocity, and force, where direction is essential. Vectors are graphically represented as directed line segments, extending from an initial point to a terminal point, denoted with bold letters or arrows placed above the symbol. Two vectors are deemed equal if they share identical magnitudes and directions,...
668
Buffers: Buffer Capacity
3.4K
Buffer capacity is the quantitative measure of a buffer to resist the change in pH. As shown in the following equation, the buffer capacity, denoted by 'beta', is expressed as the number of moles of acid or base needed to change the pH of a one-liter buffer solution by 1 unit. Here, Ca and Cb indicate the number of moles of acid and base, respectively. Note that dpH represents the change in pH.
In the graph, pH is plotted as a function of the number of moles of base (Cb) added to a weak...
In the graph, pH is plotted as a function of the number of moles of base (Cb) added to a weak...
3.4K
Scalar and Vectors
2.5K
In mechanics, commonly used terms like force, speed, velocity, and work can be classified as either scalar or vector quantities. A scalar is a physical quantity that can be described by its magnitude alone and does not require any directional components. Examples of scalar quantities are mass, area, and length.
Scalar quantities with the same physical units can be added or subtracted according to the usual algebra rules for numbers. For example, a class ending 10 min earlier than 50 min lasts...
Scalar quantities with the same physical units can be added or subtracted according to the usual algebra rules for numbers. For example, a class ending 10 min earlier than 50 min lasts...
2.5K
Types of Errors: Detection and Minimization
12.1K
Error is the deviation of the obtained result from the true, expected value or the estimated central value. Errors are expressed in absolute or relative terms.
Absolute error in a measurement is the numerical difference from the true or central value. Relative error is the ratio between absolute error and the true or central value, expressed as a percentage.
Errors can be classified by source, magnitude, and sign. There are three types of errors: systematic, random, and gross.
Systematic or...
Absolute error in a measurement is the numerical difference from the true or central value. Relative error is the ratio between absolute error and the true or central value, expressed as a percentage.
Errors can be classified by source, magnitude, and sign. There are three types of errors: systematic, random, and gross.
Systematic or...
12.1K

