CurrentRenderLayer Material Node? Or a better way?

I was thinking about trying to make a node like what is found at this address (https://blenderartists.org/t/renderlayer-node/640751), but I realized should ask important technical questions first. Would having a Material node that outputs 1.0 if a selected renderlayer is what is currently being rendered and 0.0 otherwise be possible? Would using it to have a single material that can have different “settings” (essentially, take two different material nodegroups, and multiply each one by the result of a “currentRenderLayer” node to determine which is “used”) for different viewlayers be advisable? Would it lead to large slowdowns due to large amounts of calculations being done then turned to zero (essentially, wasted processing time) or is the node system smart enough to recognize not to bother calculating something that’s going to be multiplied by zero?