Skip to main content
U.S. flag

An official website of the United States government

Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

Defensive code's impact on software performance



David W. Flater


Defensive code is instructions added to software for the purpose of hardening it against uncontrolled failures and security problems. It is often assumed that defensive code causes a significant reduction in software performance, which justifies its omission from all but the most security-critical applications. We performed an experiment to measure the application- level performance impact of seven defensive code options on two different workloads in four different environments. Of the seven options, only one yielded clear evidence of a significant reduction in performance; the main effects of the other six were either materially or statistically insignificant.
Technical Note (NIST TN) - 1860
Report Number


Flater, D. (2015), Defensive code's impact on software performance, Technical Note (NIST TN), National Institute of Standards and Technology, Gaithersburg, MD, [online], (Accessed April 17, 2024)
Created January 26, 2015, Updated November 10, 2018