Skip to content

performance issue in will_make_matrix()  #885

Closed
@simonpcouch

Description

@simonpcouch

The internal will_make_matrix() function lapply()s on an input that could be atomic:

cls <- unique(unlist(lapply(y, class)))

This approach is quite a bit slower than something like check_outcome():

parsnip/R/misc.R

Lines 344 to 345 in 2588181

outcome_is_factor <- if (is.atomic(y)) {is.factor(y)} else {all(map_lgl(y, is.factor))}
if (!outcome_is_factor) {

Thankfully, most of the time, will_make_matrix() returns early before making it to this condition.

Metadata

Metadata

Assignees

No one assigned

    Labels

    upkeepmaintenance, infrastructure, and similar

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions