Skip to content

Commit 5c6be11

Browse files
committed
following CRAN team suggestions - adjust description here and there
1 parent 8acf49d commit 5c6be11

File tree

7 files changed

+101
-51
lines changed

7 files changed

+101
-51
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ src/*.o
66
src/*.so
77
src/*.dll
88
*.DS_Store
9+
inst/doc

DESCRIPTION

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
Package: sparsepp
22
Type: Package
3-
Title: Rcpp Interface to Sparsepp
3+
Title: 'Rcpp' Interface to 'sparsepp'
44
Version: 0.1.0
55
Date: 2016-12-29
66
Authors@R: c(
77
person("Gregory", "Popovitch", role = c("aut", "cph"), email = "greg7mdp@gmail.com"),
88
person("Google Inc", role = c("aut", "cph")),
99
person("Dmitriy", "Selivanov", role = "cre", email = "selivanov.dmitriy@gmail.com")
1010
)
11-
Description: Provides interface to sparsepp - fast, memory efficient hash map.
12-
It is derived from Google's excellent sparsehash implementation.
13-
We believe Sparsepp provides an unparalleled combination of performance and memory usage,
11+
Description: Provides interface to 'sparsepp' - fast, memory efficient hash map.
12+
It is derived from Google's excellent 'sparsehash' implementation.
13+
We believe 'sparsepp' provides an unparalleled combination of performance and memory usage,
1414
and will outperform your compiler's unordered_map on both counts.
15-
Only Google's dense_hash_map is consistently faster, at the cost of much greater
15+
Only Google's 'dense_hash_map' is consistently faster, at the cost of much greater
1616
memory usage (especially when the final size of the map is not known in advance).
1717
License: BSD_3_clause + file LICENSE
1818
Encoding: UTF-8
19-
URL: https://github.com/dselivanov/sparsepp, https://github.com/greg7mdp/
20-
sparsepp
19+
URL: https://github.com/greg7mdp/sparsepp, https://github.com/dselivanov/sparsepp
2120
BugReports: https://github.com/dselivanov/sparsepp/issues
2221
RoxygenNote: 5.0.1

LICENSE

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,3 @@
1-
// ----------------------------------------------------------------------
2-
// Copyright (c) 2016, Gregory Popovitch - greg7mdp@gmail.com
3-
// All rights reserved.
4-
//
5-
// This work is derived from Google's sparsehash library
6-
//
7-
// Copyright (c) 2005, Google Inc.
8-
// All rights reserved.
9-
//
10-
// Redistribution and use in source and binary forms, with or without
11-
// modification, are permitted provided that the following conditions are
12-
// met:
13-
//
14-
// * Redistributions of source code must retain the above copyright
15-
// notice, this list of conditions and the following disclaimer.
16-
// * Redistributions in binary form must reproduce the above
17-
// copyright notice, this list of conditions and the following disclaimer
18-
// in the documentation and/or other materials provided with the
19-
// distribution.
20-
// * Neither the name of Google Inc. nor the names of its
21-
// contributors may be used to endorse or promote products derived from
22-
// this software without specific prior written permission.
23-
//
24-
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25-
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26-
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27-
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28-
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29-
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30-
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31-
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32-
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33-
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34-
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35-
// ----------------------------------------------------------------------
36-
1+
YEAR: 2005, 2016
2+
COPYRIGHT HOLDER: Google Inc., Gregory Popovitch <greg7mdp@gmail.com>
3+
ORGANIZATION: Google Inc.

R/package-sparsepp.R

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,49 @@
11
#' sparsepp
22
#'
33
#' \code{sparsepp} provides bindings to the
4-
#' \href{https://github.com/greg7mdp/sparsepp}{sparsepp} - fast, memory efficient hash map for C++
4+
#' \href{https://github.com/greg7mdp/sparsepp}{sparsepp} - fast, memory efficient hash map for C++.
55
#' \code{sparsepp} is an open source C++ library derived from Google's
6-
#' excellent sparsehash implementation. It aims to achieve the following objectives:
6+
#' excellent sparsehash implementation, but considerably outperform it - \url{https://github.com/greg7mdp/sparsepp/blob/master/bench.md}.
7+
#' It aims to achieve the following objectives:
78
#' \itemize{
89
#' \item A drop-in alternative for unordered_map and unordered_set.
910
#' \item Extremely low memory usage (typically about one byte overhead per entry).
1011
#' \item Very efficient, typically faster than your compiler's unordered map/set or Boost's.
1112
#' \item C++11 support (if supported by compiler).
1213
#' \item Single header implementation - just copy sparsepp.h to your project and include it.
1314
#' \item Tested on Windows (vs2010-2015, g++), linux (g++, clang++) and MacOS (clang++).
15+
#' }
16+
#' @examples
17+
#' \dontrun{
18+
#' library(Rcpp)
19+
#' code = "
20+
#' #include <Rcpp.h>
21+
#' using namespace std;
22+
#' using namespace Rcpp;
23+
#' // drop-in replacement for unordered_map
24+
#' //#include <unordered_map>
25+
#' #include <sparsepp.h>
26+
#' using spp::sparse_hash_map;
27+
#' // @export
28+
#' // [[Rcpp::export]]
29+
#' IntegerVector word_count(CharacterVector v) {
30+
#' //unordered_map<string, int> smap;
31+
#' sparse_hash_map<string, int> smap;
32+
#' for(auto x: v) {
33+
#' smap[as<string>(x)] ++;
34+
#' }
35+
#' IntegerVector res(smap.size());
36+
#' int i = 0;
37+
#' for(auto s:smap) {
38+
#' res[i]=s.second;
39+
#' i++;
40+
#' }
41+
#' return(res);
42+
#' }"
43+
#' f = tempfile(, fileext = ".cpp")
44+
#' writeLines(code, f)
45+
#' sourceCpp(f)
46+
#' unlink(f)
47+
#' word_count(sample(letters, 100, T))
1448
#'}
1549
"_PACKAGE"

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,30 @@
1-
# Use `sparsepp` from another package
1+
## Benchmarks
2+
3+
Check original [sparsepp](https://github.com/greg7mdp/sparsepp) repository and [write-up](https://github.com/greg7mdp/sparsepp/blob/master/bench.md) which compares hashmap implementations.
4+
5+
![insert-benchmark](https://raw.githubusercontent.com/greg7mdp2/img/master/sparsepp/insert_large_0.PNG)
6+
7+
## Use sparsepp from another package
28
To use C++ code from `sparsepp`:
39

410
1. In DESCRIPTION, add `LinkingTo: sparsepp`.
511
1. In the C++ file, add:
612
`#include <sparsepp.h>`
713

8-
# Simple example
14+
## Simple example
915

1016
```c++
1117
#include <sparsepp.h>
1218
using spp::sparse_hash_map;
1319
sparse_hash_map<string, int> smap;
1420
```
15-
# Defining custom hash function
21+
## Defining custom hash function
1622

1723
```c++
1824
#include <iostream>
1925
#include <functional>
2026
#include <string>
21-
#include "sparsepp.h"
27+
#include <sparsepp.h>
2228

2329
using std::string;
2430

cran-comments.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## Resubmission
2+
This is a resubmission. In this version:
3+
4+
* Put single quote around package names in Title and Description fields.
5+
* Fixed URLs
6+
* Added example to doc
7+
18
## Test environments
29

310
* local OS X install, R 3.3.1
@@ -7,3 +14,4 @@
714

815
R CMD check results
916
0 errors | 0 warnings | 0 notes
17+

man/sparsepp-package.Rd

Lines changed: 37 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)