mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-09-20 00:55:58 -04:00
0.1.3 UUID
This commit is contained in:
parent
eb9557448e
commit
625779fd3d
@ -99,6 +99,8 @@ Not tested ESP32 (and many other platforms) yet.
|
||||
Performance measured with **UUID_test.ino** shows the following times:
|
||||
|
||||
|
||||
#### microseconds per byte
|
||||
|
||||
| Version | Function | UNO 16 MHz | ESP32 240 MHz |
|
||||
|:-------:|:------------|:----------:|:-------------:|
|
||||
| 0.1.0 | seed | 4 us | |
|
||||
@ -108,16 +110,19 @@ Performance measured with **UUID_test.ino** shows the following times:
|
||||
| 0.1.1 | generate | 248 us | |
|
||||
| 0.1.1 | toCharArray | 4 us | |
|
||||
| 0.1.2 | generate | 156 us | |
|
||||
| 0.1.3 | generate | 120 us | |
|
||||
|
||||
Note: generating the 16 random bytes already takes ~40 us.
|
||||
|
||||
|
||||
|
||||
UUID's per second
|
||||
#### UUID's per second
|
||||
|
||||
| Version | UNO 16 MHz | ESP32 240 MHz | notes |
|
||||
|:-------:|:------------:|:---------------:|:------:|
|
||||
| 0.1.0 | 2000++ | |
|
||||
| 0.1.1 | 4000++ | | generate both modes
|
||||
| 0.1.2 | 6400++ | | generate both modes
|
||||
| 0.1.3 | 8200++ | | generate both modes
|
||||
|
||||
|
||||
Note that this maximum is not realistic e.g. for a server where also
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// FILE: UUID.cpp
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.1.2
|
||||
// VERSION: 0.1.3
|
||||
// DATE: 2022-06-14
|
||||
// PURPOSE: Arduino Library for generating UUID's
|
||||
// URL: https://github.com/RobTillaart/UUID
|
||||
@ -14,8 +14,9 @@
|
||||
// fix bug in generator
|
||||
// define UUID_MODE_VARIANT4
|
||||
// define UUID_MODE_RANDOM
|
||||
// 0.1.2 2022-06-16 fix version number
|
||||
// 0.1.2 2022-06-15 fix version number
|
||||
// improve performance generate()
|
||||
// 0.1.3 2022-06-16 improve performance generate() again
|
||||
|
||||
|
||||
#include "UUID.h"
|
||||
@ -71,12 +72,13 @@ void UUID::generate()
|
||||
|
||||
// process one byte at the time instead of a nibble
|
||||
uint8_t nr = i / 4;
|
||||
uint8_t ch = _ar[nr] & 0xF;
|
||||
uint8_t xx = _ar[nr];
|
||||
uint8_t ch = xx & 0xF;
|
||||
_buffer[j++] = (ch < 10) ? '0' + ch : ('a' - 10) + ch;
|
||||
|
||||
ch = (_ar[nr] >> 4) & 0xF;
|
||||
_buffer[j++] = (ch < 10) ? '0' + ch : ('a' - 10) + ch;
|
||||
ch = (xx >> 4) & 0xF;
|
||||
_ar[nr] >>= 8;
|
||||
_buffer[j++] = (ch < 10) ? '0' + ch : ('a' - 10) + ch;
|
||||
}
|
||||
_buffer[36] = 0;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// FILE: UUID.h
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.1.2
|
||||
// VERSION: 0.1.3
|
||||
// DATE: 2022-06-14
|
||||
// PURPOSE: Arduino Library for generating UUID's
|
||||
// URL: https://github.com/RobTillaart/UUID
|
||||
@ -15,7 +15,7 @@
|
||||
#include "Printable.h"
|
||||
|
||||
|
||||
#define UUID_LIB_VERSION (F("0.1.2"))
|
||||
#define UUID_LIB_VERSION (F("0.1.3"))
|
||||
|
||||
// TODO an enum?
|
||||
#define UUID_MODE_VARIANT4 0
|
||||
|
12
libraries/UUID/examples/UUID_test/output_0.1.3.txt
Normal file
12
libraries/UUID/examples/UUID_test/output_0.1.3.txt
Normal file
@ -0,0 +1,12 @@
|
||||
UUID_test.ino
|
||||
UUID_LIB_VERSION: 0.1.3
|
||||
seed: 8
|
||||
generate: 120
|
||||
toCharArray: 4
|
||||
UUID: 0ac82d02-002b-4ccb-b96c-1c7839cbc4c0
|
||||
UUID: d7652208-bd86-400d-93eb-eeafc12fe18d
|
||||
UUID: cf48f771-f39b-4fdd-a324-acad1c7ac596
|
||||
UUID: f74404e9-3cf4-4769-8c15-1a278e126987
|
||||
UUID: 4fe109d9-09d6-41e0-885a-b4ee716d1f5d
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/RobTillaart/UUID.git"
|
||||
},
|
||||
"version": "0.1.2",
|
||||
"version": "0.1.3",
|
||||
"license": "MIT",
|
||||
"frameworks": "arduino",
|
||||
"platforms": "*",
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=UUID
|
||||
version=0.1.2
|
||||
version=0.1.3
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Arduino library for generating UUID's. (experimental).
|
||||
|
Loading…
Reference in New Issue
Block a user