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.

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.

Related Concept Videos

Optimization Problems01:26

Optimization Problems

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 Operations01:20

Vector Operations

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.
2.6K
Vectors01:30

Vectors

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 Capacity01:09

Buffers: Buffer Capacity

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...
3.4K
Scalar and Vectors01:22

Scalar and Vectors

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...
2.5K
Types of Errors: Detection and Minimization01:12

Types of Errors: Detection and Minimization

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...
12.1K