[Rd] R_check_class_etc(x, valid) is "slow" when 'valid' contains class(x)

Mikael Jagan j@g@nmn2 @end|ng |rom gm@||@com
Sun Aug 28 01:13:31 CEST 2022


R_check_class_etc(x, valid) spends a nontrivial amount of time finding
an environment 'rho' containing the definition of class(x), evaluating
(in R, not C) methods::.classEnv(class(x)).

It then returns the result of R_check_class_and_super(x, valid, rho).
But R_check_class_and_super() does not use 'rho' at all in the trivial
case where class(x) is found in 'valid'.

My feeling is that this can be improved.  I am happy to contribute a patch,
if it would be considered by R-core.

Mikael



More information about the R-devel mailing list