DataHaskell / dh-core

Functional data science
138 stars 23 forks source link

Implement `column` from `unsafeIndex` #57

Closed Magalame closed 5 years ago

Magalame commented 5 years ago

This gets rid of the temporary vector that U.enumFromStepNwas allocating. This vector was seemingly preventing stream fusion to occur in multiply. According to the benchmarks from #56, on 100100 matrices, the new column is twice as fast, allocates half as much memory, and multiply goes from allocating 17,040,080 bytes to 80,080 (when multiply is not* inlined, ~240 000 when it is) and is a bit less than two times faster. With the llvm backend, it's well within the range of a naive C implementation.

Magalame commented 5 years ago

Should I open an issue for the vector folks then?

Also, indeed!

Shimuuar commented 5 years ago

I don't thuink it's good issue for vector in its current form. It's of kind "for some reason stream fusion seems to not fire". I don't think vector have resources for tracking down such vague issues. Esp. since rule based fusion is somewhat fragile

ocramz commented 5 years ago

Understanding why and where fusion rules fire and where they don't is an interesting exercise for a rainy Sunday ;) , for now I'll merge this PR and perhaps soon we can start looking into cutting a new release of dense-linear-algebra and statistics @Shimuuar