sure, that's fine. didn't realize it was such a stark difference.


On Wed, Feb 26, 2014 at 11:18 AM, Xiangrui Meng <notifications@github.com>wrote:

> In src/main/scala/breeze/linalg/zipValues.scala:
>
> > @@ -0,0 +1,18 @@
> > +package breeze.linalg
> > +
> > +import breeze.generic.UFunc
> > +
> > +object zipValues extends UFunc {
> > +
> > +}
> > +
> > +/**
> > + * Usually used as the return type from zipValues
> > + * @tparam V1
> > + * @tparam V2
> > + */
> > +trait ZippedValues[@specialized(Double) V1, @specialized(Double) V2] {
> > +  def foreach[A](f: (V1,V2)=>A)
>
> Making the return value generic hurts performance. Similar to the norm
> case, I noticed 3x performance gain after I changed A to Unit. The
> performance is similar to the bare-bone implementation after this change.
> So maybe we should use Unit directly and fix this in other places.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/mengxr/breeze/pull/1/files#r10094328>
> .
>