Skip to content

[Rcpp-devel] [small ann] Sparse++

2 messages · Dmitriy Selivanov, Dirk Eddelbuettel

#
Hello mailing list. Just small announcement. I made package "sparsepp"
 which brings bindings to header only 'sparsepp' library  -
https://github.com/greg7mdp/sparsepp. It is on CRAN already. Sparse++ is
improvement over google sparse hash library (see this write-up
https://github.com/greg7mdp/sparsepp/blob/master/bench.md).

Initially I evaluated it with my text2vec package, where main data
structure is unordered_map< pair<uint32_t, uint32_t>, T >, where T is int
or float.
In my case memory improvement was 2x and speed up was 1.5x (lookup and
insert operations).

So I decided to build small package which can be used by other people (not
text2vec only).

Usage is as usual

   1. add to DESCRIPTION of your package: LinkingTo: sparsepp
   2. add #include <sparsepp.h> to you source/header
   3. use spp::sparse_hash_map as drop-in replacement for std::unordered_map
   .
#
On 30 December 2016 at 15:49, Dmitriy Selivanov wrote:
| Hello mailing list. Just small announcement. I made package "sparsepp" ?which
| brings bindings to header only 'sparsepp' library ?-?https://github.com/
| greg7mdp/sparsepp. It is on CRAN already. Sparse++ is improvement over google
| sparse hash library (see this write-up https://github.com/greg7mdp/sparsepp/
| blob/master/bench.md).
| 
| Initially I evaluated it with my text2vec package, where main data structure
| is?unordered_map< pair<uint32_t, uint32_t>, T >, where T is int or float.
| In my case memory improvement was 2x and speed up was 1.5x (lookup and insert
| operations).
| 
| So I decided to build small package which can be used by other people (not
| text2vec only).
| 
| Usage is as usual?
| 
|  1. add to DESCRIPTION of your package: LinkingTo: sparsepp
|  2. add #include <sparsepp.h>?to you source/header?
|  3. use?spp::sparse_hash_map?as drop-in replacement for?std::unordered_map.

Thanks, possibly very useful.

Now, should it have at least a 'Suggests: Rcpp' if the example requires it,
\dontrun{} or not?  Also examine whose project you're posting on.

Sure it "could" be used from R without Rcpp.  But how likely is that?
Suggests is for exactly that reason, at least in my book.

Dirk