-
Notifications
You must be signed in to change notification settings - Fork 44
Closed
Description
In a benchmark for an application, switching to nonstd::span (instead of passing raw pointer and size) resulted in a 2x performance decrease. This was due to the bound checking line for the bracket operator:
span_EXPECTS( detail::is_positive( idx ) && idx < size() );
The default behavior for std::span
is to not do bound checking:
"Returns a reference to the idx-th element of the sequence. The behavior is undefined if idx is out of range (i.e., if it is greater than or equal to size())." https://en.cppreference.com/w/cpp/container/span/operator_at
So I believe that behavior should be mirrored or given as a config option.
Metadata
Metadata
Assignees
Labels
No labels