Skip to content
This repository has been archived by the owner on Nov 18, 2023. It is now read-only.

Enhance performance by using Unboxed Vectors #54

Open
OlivierSohn opened this issue Feb 10, 2018 · 2 comments
Open

Enhance performance by using Unboxed Vectors #54

OlivierSohn opened this issue Feb 10, 2018 · 2 comments

Comments

@OlivierSohn
Copy link

I think the library would benefit from using Unboxed vectors (this and that ) instead the boxed versions.

Runtime performance would be enhanced because less memory will be required (one word less by matrix element) and many operations will be faster (because the CPU caches will be used more efficiently, as a continuous block of memory will contain more relevant information than before).

@OlivierSohn OlivierSohn changed the title Better performance by using Unboxed Vectors Enhance performance by using Unboxed Vectors Feb 10, 2018
@Daniel-Diaz
Copy link
Owner

However, that would restrict what types can be used as elements of the matrix. We want to be able to use matrices for more than just numbers. We could have a separate module for an unboxed version, although that would require some work.

@OlivierSohn
Copy link
Author

OlivierSohn commented Feb 11, 2018

@Daniel-Diaz I didn't think of the aspect you mention, I was assuming every value is Unbox.

Now that I think about it, in my case the real need is to have a matrix of booleans. Even an Unboxed matrix would be far from an optimal representation, I may need to implement a matrix on top of ByteString, with bit-shifting to access elements if I want to really optimize for memory.

Edit : I'm leaving the issue opened in case someone has time to implement the unboxed version, but feel free to close it if it's not in your plans.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants