SEXP constants R_FalseValue and R_TrueValue are defined in src/include/Defn.h. At least (deprecated) matrixStats::anyMissing() allocates a logical vector of length one and then sets it. Using the constants avoids unnecessary allocations and garbage collections. Are there other places where those constants can be used?
UPDATE: They are only accessible via inline ScalarLogical(FALSE), ScalarLogical(TRUE), ... - but those should be equally efficient after compilation.
SEXP
constantsR_FalseValue
andR_TrueValue
are defined insrc/include/Defn.h
. At least (deprecated)matrixStats::anyMissing()
allocates a logical vector of length one and then sets it. Using the constants avoids unnecessary allocations and garbage collections. Are there other places where those constants can be used?UPDATE: They are only accessible via inline
ScalarLogical(FALSE)
,ScalarLogical(TRUE)
, ... - but those should be equally efficient after compilation.