Commit 93c4e88
committed
Improve message_id generation speed.
Messages ids are currently UUID4, and can't be yet replaced by a faster
and more efficient format because of some backward compatibilities
issues.
The solution here is to generate an UUID4 as a base, and then replace
its "time_low" part (4 bytes) by a randomly chosen unsigned integer
(32bits) incrementing until a randomly chosen limit. When the limit is
reached, a new UUID4 is generated and a new value is randomly chosen for
the unsigned integer and its limit.
Speedup is between ~4x and ~20x depending of the speed of the local
entropy generation.1 parent f1884db commit 93c4e88
1 file changed
+12
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| 46 | + | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
52 | 59 | | |
53 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
54 | 65 | | |
55 | 66 | | |
56 | 67 | | |
| |||
0 commit comments