some perf improvements for dense on sparse operations