Cargando…
A Case Study of Performance Degradation Attributable to Run-Time Bounds Checks on C++ Vector Access
Programmers routinely omit run-time safety checks from applications because they assume that these safety checks would degrade performance. The simplest example is the use of arrays or array-like data structures that do not enforce the constraint that indices must be within bounds. This report docum...
Autores principales: | , |
---|---|
Formato: | Online Artículo Texto |
Lenguaje: | English |
Publicado: |
[Gaithersburg, MD] : U.S. Dept. of Commerce, National Institute of Standards and Technology
2013
|
Materias: | |
Acceso en línea: | https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4487316/ https://www.ncbi.nlm.nih.gov/pubmed/26401432 http://dx.doi.org/10.6028/jres.118.012 |
_version_ | 1782378985892610048 |
---|---|
author | Flater, David Guthrie, William F |
author_facet | Flater, David Guthrie, William F |
author_sort | Flater, David |
collection | PubMed |
description | Programmers routinely omit run-time safety checks from applications because they assume that these safety checks would degrade performance. The simplest example is the use of arrays or array-like data structures that do not enforce the constraint that indices must be within bounds. This report documents an attempt to measure the performance penalty incurred by two different implementations of bounds-checking in C and C++ using a simple benchmark and a desktop PC with a modern superscalar CPU. The benchmark consisted of a loop that wrote to array elements in sequential order. With this configuration, relative to the best performance observed for any access method in C or C++, mean degradation of only (0.881 ± 0.009) % was measured for a standard bounds-checking access method in C++. This case study showed the need for further work to develop and refine measurement methods and to perform more comparisons of this type. Comparisons across different use cases, configurations, programming languages, and environments are needed to determine under what circumstances (if any) the performance advantage of unchecked access is actually sufficient to outweigh the negative consequences for security and software quality. |
format | Online Article Text |
id | pubmed-4487316 |
institution | National Center for Biotechnology Information |
language | English |
publishDate | 2013 |
publisher | [Gaithersburg, MD] : U.S. Dept. of Commerce, National Institute of Standards and Technology |
record_format | MEDLINE/PubMed |
spelling | pubmed-44873162015-09-23 A Case Study of Performance Degradation Attributable to Run-Time Bounds Checks on C++ Vector Access Flater, David Guthrie, William F J Res Natl Inst Stand Technol Article Programmers routinely omit run-time safety checks from applications because they assume that these safety checks would degrade performance. The simplest example is the use of arrays or array-like data structures that do not enforce the constraint that indices must be within bounds. This report documents an attempt to measure the performance penalty incurred by two different implementations of bounds-checking in C and C++ using a simple benchmark and a desktop PC with a modern superscalar CPU. The benchmark consisted of a loop that wrote to array elements in sequential order. With this configuration, relative to the best performance observed for any access method in C or C++, mean degradation of only (0.881 ± 0.009) % was measured for a standard bounds-checking access method in C++. This case study showed the need for further work to develop and refine measurement methods and to perform more comparisons of this type. Comparisons across different use cases, configurations, programming languages, and environments are needed to determine under what circumstances (if any) the performance advantage of unchecked access is actually sufficient to outweigh the negative consequences for security and software quality. [Gaithersburg, MD] : U.S. Dept. of Commerce, National Institute of Standards and Technology 2013-05-22 /pmc/articles/PMC4487316/ /pubmed/26401432 http://dx.doi.org/10.6028/jres.118.012 Text en https://creativecommons.org/publicdomain/zero/1.0/ The Journal of Research of the National Institute of Standards and Technology is a publication of the U.S. Government. The papers are in the public domain and are not subject to copyright in the United States. Articles from J Res may contain photographs or illustrations copyrighted by other commercial organizations or individuals that may not be used without obtaining prior approval from the holder of the copyright. |
spellingShingle | Article Flater, David Guthrie, William F A Case Study of Performance Degradation Attributable to Run-Time Bounds Checks on C++ Vector Access |
title | A Case Study of Performance Degradation Attributable to Run-Time Bounds Checks on C++ Vector Access |
title_full | A Case Study of Performance Degradation Attributable to Run-Time Bounds Checks on C++ Vector Access |
title_fullStr | A Case Study of Performance Degradation Attributable to Run-Time Bounds Checks on C++ Vector Access |
title_full_unstemmed | A Case Study of Performance Degradation Attributable to Run-Time Bounds Checks on C++ Vector Access |
title_short | A Case Study of Performance Degradation Attributable to Run-Time Bounds Checks on C++ Vector Access |
title_sort | case study of performance degradation attributable to run-time bounds checks on c++ vector access |
topic | Article |
url | https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4487316/ https://www.ncbi.nlm.nih.gov/pubmed/26401432 http://dx.doi.org/10.6028/jres.118.012 |
work_keys_str_mv | AT flaterdavid acasestudyofperformancedegradationattributabletoruntimeboundschecksoncvectoraccess AT guthriewilliamf acasestudyofperformancedegradationattributabletoruntimeboundschecksoncvectoraccess AT flaterdavid casestudyofperformancedegradationattributabletoruntimeboundschecksoncvectoraccess AT guthriewilliamf casestudyofperformancedegradationattributabletoruntimeboundschecksoncvectoraccess |