Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
See what's new at GitLab
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
R
RcppUUID
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Artem Klevtsov
RcppUUID
Commits
631e3199
Verified
Commit
631e3199
authored
Feb 22, 2020
by
Artem Klevtsov
😹
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use OpenMP. Update docs
parent
3d44bd86
Pipeline
#120190760
failed with stages
in 8 minutes and 53 seconds
Changes
13
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
53 additions
and
31 deletions
+53
-31
.Rbuildignore
.Rbuildignore
+1
-0
.gitignore
.gitignore
+1
-0
DESCRIPTION
DESCRIPTION
+4
-2
R/RcppExports.R
R/RcppExports.R
+1
-1
R/RcppUUID-package.R
R/RcppUUID-package.R
+4
-2
README.Rmd
README.Rmd
+5
-3
README.md
README.md
+18
-12
man/RcppUUID.Rd
man/RcppUUID.Rd
+4
-2
man/uuid_generate.Rd
man/uuid_generate.Rd
+1
-1
src/Makevars
src/Makevars
+2
-0
src/Makevars.win
src/Makevars.win
+2
-0
src/RcppExports.cpp
src/RcppExports.cpp
+1
-1
src/uuid.cpp
src/uuid.cpp
+9
-7
No files found.
.Rbuildignore
View file @
631e3199
...
...
@@ -4,6 +4,7 @@
^\.gitlab$
^ci$
^windows$
^tmp$
^src/.*\.o
^src/.*\.so
^src/.*\.dll
...
...
.gitignore
View file @
631e3199
...
...
@@ -5,3 +5,4 @@
src/*.o
src/*.so
src/*.dll
tmp
DESCRIPTION
View file @
631e3199
Package: RcppUUID
Type: Package
Title: Generating U
UID
s
Title: Generating U
niversally Unique Identificator
s
Version: 1.0.0
Authors@R: c(
person(given = "Artem",
...
...
@@ -9,7 +9,9 @@ Authors@R: c(
email = "a.a.klevtsov@gmail.com",
comment = c(ORCID = "0000-0003-0492-6647"))
)
Description: Tools for generating UUIDs (Universally Unique Identifiers).
Description: Provides funstion to generating a vector of Universally Unique Identifiers
(UUID) version 4. Based on the sole C++ library <https://github.com/r-lyeh-archived/sole>.
Used the OpenMP library to improve performance.
URL: https://artemklevtsov.gitlab.io/rcppuuid, https://gitlab.com/artemklevtsov/rcppuuid
BugReports: https://gitlab.com/artemklevtsov/rcppuuid/issues
License: GPL (>= 2)
...
...
R/RcppExports.R
View file @
631e3199
...
...
@@ -5,7 +5,7 @@
#' Generate a version 4 UUID
#'
#' @description
#' Function generates a
new Universally Unique Identifier
.
#' Function generates a
set of Universally Unique Identifiers
.
#'
#' @param n Number of generated UUIDs.
#'
...
...
R/RcppUUID-package.R
View file @
631e3199
#' @title Generating U
UID
s
#' @title Generating U
niversally Unique Identificator
s
#'
#' @description
#' Tools for generating UUIDs (Universally Unique Identifiers).
#' Provides funstion to generating a vector of Universally Unique Identifiers
#' (UUID) version 4. Based on the sole C++ library <https://github.com/r-lyeh-archived/sole>.
#' Used the OpenMP library to improve performance.
#'
#' @name RcppUUID
#' @docType package
...
...
README.Rmd
View file @
631e3199
...
...
@@ -24,7 +24,7 @@ knitr::opts_chunk$set(
<!-- badges: end -->
R package to generate Universally Unique Identifiers (UUIDs).
R package to generate Universally Unique Identifiers (UUIDs)
version 4. Based on the [sole](https://github.com/r-lyeh-archived/sole) C++ library
.
## Installation
...
...
@@ -64,9 +64,10 @@ n <- 1000000
length(unique(RcppUUID::uuid_generate(n))) == n
```
## Benchmarking
Single UUID:
```{r}
microbenchmark::microbenchmark(
uuid = uuid::UUIDgenerate(FALSE),
...
...
@@ -74,6 +75,8 @@ microbenchmark::microbenchmark(
)
```
Multiple UUIDs:
```{r}
n <- 10000
microbenchmark::microbenchmark(
...
...
@@ -82,7 +85,6 @@ microbenchmark::microbenchmark(
)
```
## Bug reports
Use the following command to go to the page for bug report submissions:
...
...
README.md
View file @
631e3199
...
...
@@ -18,7 +18,9 @@ v2](https://img.shields.io/badge/License-GPL%20v2-blue.svg)](https://www.gnu.org
<!-- badges: end -->
R package to generate Universally Unique Identifiers (UUIDs).
R package to generate Universally Unique Identifiers (UUIDs) version 4.
Based on the
[
sole
](
https://github.com/r-lyeh-archived/sole
)
C++
library.
## Installation
...
...
@@ -45,18 +47,18 @@ Generate single UUID:
```
r
RcppUUID
::
uuid_generate
(
1
)
#> [1] "
463f2be4-d35a-4918-9cf0-202c6b80f256
"
#> [1] "
1700a888-a7c5-4dd4-9aad-a98128279f87
"
```
Generate multiple UUIDs:
```
r
RcppUUID
::
uuid_generate
(
5
)
#> [1] "
fc4bf713-7ea7-418b-8050-deac2ff6eac8
"
#> [2] "
d2ba5e3b-2d65-4cad-a006-ed221cefca00
"
#> [3] "
59b5dc67-e617-42de-8b23-31be07e941cf
"
#> [4] "
33ad0521-0127-446a-8469-82e5b2442fcd
"
#> [5] "
5058e91e-ca1d-479f-9ecf-8e21e33565db
"
#> [1] "
04c01dc0-299d-461e-9b56-2f881376f445
"
#> [2] "
b18beaf4-b27c-4fed-a93c-08f80feb1fcf
"
#> [3] "
29e2778d-7b5b-4128-9184-3865953c69f0
"
#> [4] "
818d0636-d854-44a3-ab43-6fb9bbb60e40
"
#> [5] "
a09697a7-5cc5-41b3-86b3-07ba50bf8cd3
"
```
Check uniques:
...
...
@@ -69,17 +71,21 @@ length(unique(RcppUUID::uuid_generate(n))) == n
## Benchmarking
Single UUID:
```
r
microbenchmark
::
microbenchmark
(
uuid
=
uuid
::
UUIDgenerate
(
FALSE
),
RcppUUID
=
RcppUUID
::
uuid_generate
(
1
)
)
#> Unit: microseconds
#> expr min
lq
mean median uq max neval cld
#> uuid 1
4.808 15.4950 38.84707 15.8645 16.2765 2296.561
100 a
#> RcppUUID 1
0.752 11.3085 12.63245 11.9840 12.4820 69.302
100 a
#> expr min
lq
mean median uq max neval cld
#> uuid 1
5.221 16.270 59.07903 17.5115 18.4200 4167.623
100 a
#> RcppUUID 1
3.318 44.686 163.90026 65.0965 95.2315 6306.544
100 a
```
Multiple UUIDs:
```
r
n
<-
10000
microbenchmark
::
microbenchmark
(
...
...
@@ -88,8 +94,8 @@ microbenchmark::microbenchmark(
)
#> Unit: milliseconds
#> expr min lq mean median uq max neval cld
#> uuid 17
0.63409 186.62638 206.77789 194.16725 218.38896 398.37136
100 b
#> RcppUUID
33.13655 33.62311 33.84627 33.82633 34.07119 34.54811
100 a
#> uuid 17
9.76032 200.29648 225.46853 215.11818 237.76798 410.55628
100 b
#> RcppUUID
17.10199 19.23641 21.17651 20.07005 21.28216 42.02892
100 a
```
## Bug reports
...
...
man/RcppUUID.Rd
View file @
631e3199
...
...
@@ -4,9 +4,11 @@
\name{RcppUUID}
\alias{RcppUUID}
\alias{RcppUUID-package}
\title{Generating U
UID
s}
\title{Generating U
niversally Unique Identificator
s}
\description{
Tools for generating UUIDs (Universally Unique Identifiers).
Provides funstion to generating a vector of Universally Unique Identifiers
(UUID) version 4. Based on the sole C++ library <https://github.com/r-lyeh-archived/sole>.
Used the OpenMP library to improve performance.
}
\seealso{
Useful links:
...
...
man/uuid_generate.Rd
View file @
631e3199
...
...
@@ -13,7 +13,7 @@ uuid_generate(n = 1L)
Character vector with UUIDs.
}
\description{
Function generates a
new Universally Unique Identifier
.
Function generates a
set of Universally Unique Identifiers
.
}
\examples{
uuid_generate(5)
...
...
src/Makevars
View file @
631e3199
PKG_CPPFLAGS = -I../inst/include
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS)
CXX_STD = CXX11
src/Makevars.win
View file @
631e3199
PKG_CPPFLAGS = -I../inst/include -fpermissive
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS)
CXX_STD = CXX11
src/RcppExports.cpp
View file @
631e3199
...
...
@@ -6,7 +6,7 @@
using
namespace
Rcpp
;
// uuid_generate
Rcpp
::
StringVector
uuid_generate
(
size_t
n
);
std
::
vector
<
std
::
string
>
uuid_generate
(
size_t
n
);
RcppExport
SEXP
_RcppUUID_uuid_generate
(
SEXP
nSEXP
)
{
BEGIN_RCPP
Rcpp
::
RObject
rcpp_result_gen
;
...
...
src/uuid.cpp
View file @
631e3199
...
...
@@ -5,7 +5,7 @@
//' Generate a version 4 UUID
//'
//' @description
//' Function generates a
new Universally Unique Identifier
.
//' Function generates a
set of Universally Unique Identifiers
.
//'
//' @param n Number of generated UUIDs.
//'
...
...
@@ -16,11 +16,13 @@
//' @examples
//' uuid_generate(5)
//'
// [[Rcpp::export(rng = false)]]
Rcpp
::
StringVector
uuid_generate
(
size_t
n
=
1
)
{
std
::
vector
<
sole
::
uuid
>
uuids
(
n
);
std
::
generate
(
uuids
.
begin
(),
uuids
.
end
(),
sole
::
uuid4
);
Rcpp
::
StringVector
res
=
Rcpp
::
no_init
(
n
);
std
::
transform
(
uuids
.
begin
(),
uuids
.
end
(),
res
.
begin
(),
[](
const
sole
::
uuid
&
x
)
{
return
x
.
str
();
});
// [[Rcpp::export(rng=false)]]
std
::
vector
<
std
::
string
>
uuid_generate
(
size_t
n
=
1
)
{
std
::
vector
<
std
::
string
>
res
(
n
);
#pragma omp parallel for
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
{
sole
::
uuid
id
=
sole
::
uuid4
();
res
[
i
]
=
id
.
str
();
}
return
res
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment