Verified Commit 89f356f6 authored by Artem Klevtsov's avatar Artem Klevtsov 😹

Update docs

parent 05dd2260
Pipeline #122142646 passed with stages
in 10 minutes and 20 seconds
......@@ -10,7 +10,8 @@ Authors@R: c(
comment = c(ORCID = "0000-0003-0492-6647"))
)
Description: Provides funstion to generating a vector of Universally Unique Identifiers (UUID).
Used the OpenMP library to improve performance.
Used implementation from the Boost C++ library. Supported random (version 4) and name (version 5)
UUIDs. UUIDs generation are parallelized by OpenMP.
URL: https://artemklevtsov.gitlab.io/rcppuuid, https://gitlab.com/artemklevtsov/rcppuuid
BugReports: https://gitlab.com/artemklevtsov/rcppuuid/issues
License: GPL (>= 2)
......
#' @title Generating Universally Unique Identificators
#'
#' @description
#' Provides funstion to generating a vector of Universally Unique Identifiers
#' (UUID). Used the OpenMP library to improve performance.
#' Provides funstion to generating a vector of Universally Unique Identifiers (UUID).
#' Used implementation from the Boost C++ library. Supported random (version 4) and name (version 5)
#' UUIDs. UUIDs generation are parallelized by OpenMP.
#'
#' @name RcppUUID
#' @docType package
......
#' @title
#' Generate UUID
#' Generate UUIDs
#'
#' @description
#' Function generates a set of Universally Unique Identifiers.
#' Supported version 4 and 5 UUIDs.
#'
#' @param n Number of generated UUIDs.
#' @param x Character vector.
......@@ -11,7 +12,6 @@
#'
#' @name uuid_generate
#'
#'
#' @examples
#' # generate random UUIDs
#' uuid_generate_random(2)
......
......@@ -25,7 +25,7 @@ options(width = 120)
<!-- badges: end -->
R package to generate Universally Unique Identifiers (UUIDs).
R package to generate Universally Unique Identifiers (UUIDs) version 4 and 5.
## Installation
......@@ -45,6 +45,8 @@ This package contains the compiled code, therefore you have to use the [Rtools](
## Usage
### Generate version 4 UUIDs
Generate single UUID:
```{r}
......@@ -64,14 +66,14 @@ n <- 1000000
length(unique(RcppUUID::uuid_generate_random(n))) == n
```
## Benchmarking
Benchmarking:
Single UUID:
```{r}
microbenchmark::microbenchmark(
uuid = uuid::UUIDgenerate(FALSE),
RcppUUID = RcppUUID::uuid_generate_random(1)
RcppUUID = RcppUUID::uuid_generate_random()
)
```
......@@ -80,11 +82,26 @@ Multiple UUIDs:
```{r}
n <- 10000
microbenchmark::microbenchmark(
uuid = replicate(n, uuid::UUIDgenerate(FALSE)),
uuid = uuid::UUIDgenerate(FALSE, n),
RcppUUID = RcppUUID::uuid_generate_random(n)
)
```
### Generate version 5 UUIDs
Generate version UUIDs based on the text input:
```{r}
RcppUUID::uuid_generate_name(letters)
```
For the each unique input will be generated unique UUID. Check uniqueness:
```{r}
uuids <- replicate(10, RcppUUID::uuid_generate_name(letters))
length(unique(as.vector(uuids))) == length(letters)
```
## Bug reports
Use the following command to go to the page for bug report submissions:
......
......@@ -18,7 +18,8 @@ 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
and 5.
## Installation
......@@ -41,19 +42,21 @@ on Windows.
## Usage
### Generate version 4 UUIDs
Generate single UUID:
``` r
RcppUUID::uuid_generate_random(1)
#> [1] "94f99d02-9aef-4235-941f-733ba4c2e114"
#> [1] "a56cd007-d384-444c-9cc0-5a8257ac3c49"
```
Generate multiple UUIDs:
``` r
RcppUUID::uuid_generate_random(5)
#> [1] "d7fcfd4a-6b3b-4c63-8086-815967264b7f" "145ca48d-013c-46f2-a0d4-23ef0b9a819a" "4a14d8de-c452-48ba-adc4-7495a389b061"
#> [4] "61176f2b-58e7-4b88-af48-7e3f00ab7ac3" "6d42e8b6-1e9b-4908-8689-bdd338050359"
#> [1] "a27dfb6e-e195-4479-9e98-f3102b2535bc" "08f60ac3-e0be-40b8-b540-eefcf05d3f4c" "ba40c747-c2e5-429d-b2b2-a835af0b74fc"
#> [4] "65fefc7b-0bae-4b96-89dc-4ae0afdc94a9" "0d495322-ef1f-4820-96cf-337e77782a34"
```
Check uniques:
......@@ -64,19 +67,19 @@ length(unique(RcppUUID::uuid_generate_random(n))) == n
#> [1] TRUE
```
## Benchmarking
Benchmarking:
Single UUID:
``` r
microbenchmark::microbenchmark(
uuid = uuid::UUIDgenerate(FALSE),
RcppUUID = RcppUUID::uuid_generate_random(1)
RcppUUID = RcppUUID::uuid_generate_random()
)
#> Unit: microseconds
#> expr min lq mean median uq max neval cld
#> uuid 15.080 15.8810 36.09674 16.2625 16.635 1994.061 100 a
#> RcppUUID 8.394 9.1435 13.11459 9.8820 10.487 228.525 100 a
#> uuid 15.669 16.3065 36.42114 16.6275 17.101 1973.512 100 a
#> RcppUUID 8.806 9.2210 14.12059 10.0010 10.717 250.013 100 a
```
Multiple UUIDs:
......@@ -84,13 +87,43 @@ Multiple UUIDs:
``` r
n <- 10000
microbenchmark::microbenchmark(
uuid = replicate(n, uuid::UUIDgenerate(FALSE)),
uuid = uuid::UUIDgenerate(FALSE, n),
RcppUUID = RcppUUID::uuid_generate_random(n)
)
#> Unit: milliseconds
#> expr min lq mean median uq max neval cld
#> uuid 174.885527 183.911932 203.315408 191.169173 214.918204 361.96847 100 b
#> RcppUUID 5.181347 5.462485 6.749716 5.752187 6.438479 36.75441 100 a
#> expr min lq mean median uq max neval cld
#> uuid 79.501951 81.613093 87.78974 84.14981 86.582511 229.6141 100 b
#> RcppUUID 5.511901 6.392065 12.88998 6.91313 8.714627 308.0580 100 a
```
### Generate version 5 UUIDs
Generate version UUIDs based on the text input:
``` r
RcppUUID::uuid_generate_name(letters)
#> [1] "54a0a790-c611-5b5b-b50e-ff01490ecdfa" "d5080e36-1ba4-5cb3-861c-34b25868f7db"
#> [3] "33ed51b6-a330-5830-bda9-2bac09e15753" "b74b2afe-06d5-5fea-99cc-a7de0b492704"
#> [5] "8535136c-b0d3-5373-aa79-ab67d33a2a8e" "3a876f3e-f633-5838-8e8d-85cbe7e4cfa0"
#> [7] "dcc54724-2b68-59ea-aa01-a5eedebaca0a" "be34dbb0-a054-5d66-82cb-cda5da801ce1"
#> [9] "3785df0a-16e9-5981-834c-b81e62d5b242" "77e622e0-aa2e-5aed-8b05-2e0c968b91ab"
#> [11] "e113dbba-7e25-50fd-86b4-1cd1a21c9844" "4eeb0331-584d-52d5-b466-7f1da8b50f01"
#> [13] "b9380571-a553-567e-87a2-c6961b93367f" "e3994dd9-a468-5724-85d9-08f4392e32bf"
#> [15] "dfeec8f2-ace7-57e9-8b74-1c8113a9232f" "a3406a87-1481-568c-9f64-55f36b24b02f"
#> [17] "4c93356e-1b15-50c2-aca3-4a58c1d143c4" "6356cad3-e13a-5db3-aae9-131b29997c99"
#> [19] "99f410c7-b96b-5a68-adaa-61224692decd" "246136f2-9721-5d5a-994a-ee3d1e6f9a4d"
#> [21] "9eb339b5-c976-5f06-a2cf-3e8240da4a0d" "0ad9fa60-82cb-57c1-bbae-0aa20605061e"
#> [23] "e76eef5d-bdfe-5727-a0f0-5a72649b0752" "456e503f-63e3-56c1-b807-4cd79bf8cc22"
#> [25] "d431692f-9a43-5034-bf6f-b3962773861a" "713d341e-51f1-5857-ab86-edef8fa5b522"
```
For the each unique input will be generated unique UUID. Check
uniqueness:
``` r
uuids <- replicate(10, RcppUUID::uuid_generate_name(letters))
length(unique(as.vector(uuids))) == length(letters)
#> [1] TRUE
```
## Bug reports
......
......@@ -12,7 +12,7 @@ expect_true(is.character(uuid_generate_random(1)))
expect_true(grepl(ptrn, uuid_generate_random(1)))
expect_equal(length(uuid_generate_random(1)), 1)
expect_equal(length(uuid_generate_random(5)), 5)
expect_equal(length(unique(uuid_generate_random(100))), 100)
expect_equal(length(unique(uuid_generate_random(1000))), 1000)
# uuid_generate_nil
......
......@@ -6,8 +6,9 @@
\alias{RcppUUID-package}
\title{Generating Universally Unique Identificators}
\description{
Provides funstion to generating a vector of Universally Unique Identifiers
(UUID). Used the OpenMP library to improve performance.
Provides funstion to generating a vector of Universally Unique Identifiers (UUID).
Used implementation from the Boost C++ library. Supported random (version 4) and name (version 5)
UUIDs. UUIDs generation are parallelized by OpenMP.
}
\seealso{
Useful links:
......
......@@ -5,7 +5,7 @@
\alias{uuid_generate_nil}
\alias{uuid_generate_name}
\alias{uuid_generate}
\title{Generate UUID}
\title{Generate UUIDs}
\usage{
uuid_generate_random(n = 1L)
......@@ -23,6 +23,7 @@ Character vector with UUIDs.
}
\description{
Function generates a set of Universally Unique Identifiers.
Supported version 4 and 5 UUIDs.
}
\examples{
# generate random UUIDs
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment