btwardow / FactorizationMachines.jl

Factorization Machines for Julia
Other
11 stars 6 forks source link

Subarray memory reduction #13

Closed Hydrotoast closed 8 years ago

Hydrotoast commented 8 years ago

Reducing total memory usage from 329MB to 268MB for the ml100k.jl test by using SubArrays within Julia.

The problem is that given a matrix X, accessing a column or row of the matrix X[:, c] will allocate a completely new array with the contents of X[:, c]. Julia can avoid this by using subarrays which are views/references to the subarray with the matrix. To use a subarray and avoid memory allocation: sub(X, :, c).

To support both types of SubArray and DenseVector, we convert some types to StridedVector which is essentially a union of the two.

coveralls commented 8 years ago

Coverage Status

Coverage remained the same at 96.552% when pulling 3849ceb5f0228ccf8bc2b8d716f031ae4ae214b6 on Hydrotoast:subarray-memory-reduction into fa6c4f7d0d469924ac939867325111268b13e0e0 on btwardow:master.

btwardow commented 8 years ago

Nice. It sth new for me. Thanks 👍