Boost build speed by optimizing feature tests

See #1493