turbouuid 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build ADDED
@@ -0,0 +1 @@
1
+ cd src && wat4wasm --input=uuid.wat --output=../uuid.wasm --untouched-window --wat2wasm=wat2wasm --enable-threads --keep-unused-functions --enable-multi-memory
package/index.html CHANGED
@@ -30,6 +30,47 @@
30
30
  console.log(`base.valueOf(\x1b[31m${uuid}\x1b[0m)`.padEnd(70).concat("-->"), valueOf);
31
31
  console.log(`base.randomUUID(\x1b[33m${value}\x1b[0m)`.padEnd(70).concat("-->"), randomUUID);
32
32
  console.groupEnd(`base calls:`);
33
+
34
+ {
35
+ const map = new Map();
36
+ self.array = new Array();
37
+ let count, uuid, value, t0, t1, t2, dtm, dtb;
38
+
39
+ count = 4e3;
40
+ while (count--) {
41
+ uuid = turboUUID();
42
+ value = Math.floor(Math.random() * 1e5);
43
+
44
+ if (Math.random() > 0.998) {
45
+ array.push(uuid);
46
+ }
47
+
48
+ map.set(uuid, value);
49
+ base.setValue(uuid, value);
50
+ }
51
+
52
+ console.log("ready")
53
+ new BroadcastChannel("uuid").onmessage = e => {
54
+ const uuid = e.data;
55
+
56
+ t0 = performance.mark("map_start");
57
+ map.get(uuid);
58
+ dtm = performance.measure("map", "map_start");
59
+ performance.clearMarks();
60
+ performance.clearMeasures();
61
+ performance.clearResourceTimings();
62
+
63
+ t0 = performance.mark("base_start");
64
+ base.valueOf(uuid);
65
+ dtb = performance.measure("base", "base_start");
66
+ performance.clearMarks();
67
+ performance.clearMeasures();
68
+ performance.clearResourceTimings();
69
+
70
+ console.warn({ dtm, dtb })
71
+ }
72
+ }
73
+
33
74
  })
34
75
  </script>
35
76
  </head>
package/index.js CHANGED
@@ -33,6 +33,5 @@ turboUUID.benchmark = (count = 1e6) => {
33
33
  };
34
34
 
35
35
  turboUUID.base = async () => {
36
- const wasm = Uint8Array.from(`0061736d0100000001a6011e6000017c6000016f60017f016f60016f017e60016f017f60027f7f016f60016f016f60036f7f7f0060036f7f7f016f60036f7f6f0060026f6f016f60036f6f6f0060036f7f6f016f60036f7e6f016f60036f6f6f016f60056f6f6f6f6f016f60026f6f0060027f7f0060017f017f60016f0060026f7f006000017f60017b017f60027f7b0060026f7f016f60027e7f016f60000060026f6f017e60026f6f017f60016f017b029c02140473656c660473656c66036f00044d6174680672616e646f6d00000473656c66054172726179000106537472696e670c66726f6d43686172436f6465036f00054172726179026f6600020473656c6606426967496e7400030473656c66064e756d6265720004054172726179026f660005054172726179026f660006075265666c656374037365740007054172726179026f660008075265666c656374037365740009054172726179026f66000a075265666c65637403676574000a075265666c656374056170706c79000b075265666c656374056170706c79000c075265666c656374056170706c79000d075265666c65637409636f6e737472756374000a075265666c656374056170706c79000e054172726179026f66000f031e1d10111213140212040415040216151617180605191a0a0a1b1c1d15151a0404016f001b052b07030101038827ffff03038827ffff0303904effff0303a09c01ffff0303c0b802ffff0303a09c01ffff03063e0c7f0041240b7f00412c0b7f0041300b7f0041c0000b6f01d06f0b6f01d06f0b6f01d06f0b6f01d06f0b6f01d06f0b6f01d06f0b6f01d06f0b6f01d06f0b07570906757569644174001d0776616c75654f66001a07696e6465784f66001c0873657456616c7565001603686173001905636f756e74001b07666f724561636800120672656d6f766500150a72616e646f6d55554944001708012e0904010300000c01010ae3211d5401027bfd0cffffffff04000000010000000000000021022003101bfd1c00210303402003fd1b000440200020012003fd1b02101d2003fd1b01284206002003fd1b021008100c20032002fdae0121030c010b0b0b0d00410420006c2001364206000b0b00410420006c284206000b2d01017f417f2000101c22014604400f0b2001fd0c0000000000000000000000000000000010212001410010130b2802017f017b2000102b21032003101e2102417f2002460440102c2202200310210b2002200110130b080020001018101d0b0e01017f101f22012000101320010b0900417f2000101c470b1701017f417f2000101c220147047f200110140541000b0b070023022802000b08002000102b101e0b6801017bfd0c010000000200000004000000080000002000fd11fdb50121012001fd1b002d400100410210242001fd1b002d400200410210242001fd1b012f410300410410242001fd1b0228420400410810242001fd1b03294305004110102510111023230c10280b360023042000fd16003a000023042000fd16013a000123042000fd19013b010223042000fd1b0136020423042000fd1d01370308102d0b180023051000390300230510003903082305fd00040010200b0e01017f102c22012000102120010b6501017bfd0c010000000200000004000000080000002000fd11fdb50121022002fd1b002001fd16003a4001002002fd1b002001fd16013a4002002002fd1b012001fd19013b4103002002fd1b022001fd1b01364204002002fd1b032001fd1d01374305000b100041102500200020014100100510100b1400410f250020002301230023001010100610100b1200410e2500200041101002100d200110220b1200410d2500200041101002100e200110220b68002302410036020023034101360200410a250023012300230010101027240641092500410425001027240741082500410425001027240841072500410425001027240941062500410425001027240a41052500410425001027240b41032500410225001027240c0b1400410c2500200041012500100a100f2001100a0b0c00410b25002000200110100b0a0020002001102810030b0a0020002001102810040b4501017b2000230610282100200120002307102afd1700220120002308102afd1701220120002309102afd1a0122012000230a102afd1c0122012000230b1029fd1e0122010b2001017f23024101fe1e02002200200041107045044023034101fe1e02001a0b0b9a0503017f057b067f23042d000021002304fd07000121012304fd08010221022304fd09020421032304fd0a030821044100210a2303280200210b0340200b0440fd0c10000000200000004000000080000000200afd11fdb50121052005fd1b0021062005fd1b0121072005fd1b0221082005fd1b032109200a41016a210a200b41016b210b20012006fd00440200fd24fd630d0120022007fd00440300fd51fd53044020032008fd00440400fd51fd53044020042009fd00440500fd51fd53044020062d4001002000460440200641006a0f0b200020062d400101460440200641016a0f0b0b20042009fd00440510fd51fd530440200020062d400102460440200641026a0f0b200020062d400103460440200641036a0f0b0b0b20032008fd00440410fd51fd53044020042009fd00440520fd51fd530440200020062d400104460440200641046a0f0b200020062d400105460440200641056a0f0b0b20042009fd00440530fd51fd530440200020062d400106460440200641066a0f0b200020062d400107460440200641076a0f0b0b0b0b20022007fd00440310fd51fd53044020032008fd00440420fd51fd53044020042009fd00440540fd51fd530440200020062d400108460440200641086a0f0b200020062d400109460440200641096a0f0b0b20042009fd00440550fd51fd530440200020062d40010a4604402006410a6a0f0b200020062d40010b4604402006410b6a0f0b0b0b20032008fd00440430fd51fd53044020042009fd00440560fd51fd530440200020062d40010c4604402006410c6a0f0b200020062d40010d4604402006410d6a0f0b0b20042009fd00440570fd51fd530440200020062d40010e4604402006410e6a0f0b200020062d40010f4604402006410f6a0f0b0b0b0b0c010b0b417f0bb11502056f037f02402300026f1001240d230d410041d4001007230d410141e5001007230d410241f8001007230d410341f4001007230d410441c4001007230d410541e5001007230d410641e3001007230d410741ef001007230d410841e4001007230d410941e5001007230d410a41f20010072301d06f230d1010d06f240d0b100b2300100f21002000026f1001240d230d410041e4001007230d410141e5001007230d410241e3001007230d410341ef001007230d410441e4001007230d410541e50010072301d06f230d1010d06f240d0b100b21012300026f1001240d230d410041d5001007230d410141e9001007230d410241ee001007230d410341f4001007230d410441381007230d410541c1001007230d410641f2001007230d410741f2001007230d410841e1001007230d410941f90010072301d06f230d1010d06f240d0b100b21020b410041002802000240024041002105410421064102210710012103200341002007100720022003100f2104034020070440410020064101fc0800002004200541002d00001007200541016a2105200641016a2106200741016b21070c010b0b1001210320034100200410094101200120002003101026000b02404100210541062106410e210710012103200341002007100720022003100f2104034020070440410020064101fc0800002004200541002d00001007200541016a2105200641016a2106200741016b21070c010b0b1001210320034100200410094102200120002003101026000b0240410021054114210641c400210710012103200341002007100720022003100f2104034020070440410020064101fc0800002004200541002d00001007200541016a2105200641016a2106200741016b21070c010b0b1001210320034100200410094103200120002003101026000b02404100210541d80021064104210710012103200341002007100720022003100f2104034020070440410020064101fc0800002004200541002d00001007200541016a2105200641016a2106200741016b21070c010b0b1001210320034100200410094104200120002003101026000b02404100210541dc002106412c210710012103200341002007100720022003100f2104034020070440410020064101fc0800002004200541002d00001007200541016a2105200641016a2106200741016b21070c010b0b1001210320034100200410094105200120002003101026000b0240410021054188012106412c210710012103200341002007100720022003100f2104034020070440410020064101fc0800002004200541002d00001007200541016a2105200641016a2106200741016b21070c010b0b1001210320034100200410094106200120002003101026000b02404100210541b4012106412c210710012103200341002007100720022003100f2104034020070440410020064101fc0800002004200541002d00001007200541016a2105200641016a2106200741016b21070c010b0b1001210320034100200410094107200120002003101026000b02404100210541e0012106412c210710012103200341002007100720022003100f2104034020070440410020064101fc0800002004200541002d00001007200541016a2105200641016a2106200741016b21070c010b0b1001210320034100200410094108200120002003101026000b024041002105418c022106412c210710012103200341002007100720022003100f2104034020070440410020064101fc0800002004200541002d00001007200541016a2105200641016a2106200741016b21070c010b0b1001210320034100200410094109200120002003101026000b02404100210541b80221064109210710012103200341002007100720022003100f2104034020070440410020064101fc0800002004200541002d00001007200541016a2105200641016a2106200741016b21070c010b0b100121032003410020041009410a200120002003101026000b02404100210541c10221064108210710012103200341002007100720022003100f2104034020070440410020064101fc0800002004200541002d00001007200541016a2105200641016a2106200741016b21070c010b0b1001210320034100200410094111200120002003101026000b02404100210541c90221064109210710012103200341002007100720022003100f2104034020070440410020064101fc0800002004200541002d00001007200541016a2105200641016a2106200741016b21070c010b0b1001210320034100200410094112200120002003101026000b02404100210541d20221064106210710012103200341002007100720022003100f2104034020070440410020064101fc0800002004200541002d00001007200541016a2105200641016a2106200741016b21070c010b0b1001210320034100200410094113200120002003101026000b02404100210541d80221064104210710012103200341002007100720022003100f2104034020070440410020064101fc0800002004200541002d00001007200541016a2105200641016a2106200741016b21070c010b0b1001210320034100200410094114200120002003101026000b02404100210541dc0221064105210710012103200341002007100720022003100f2104034020070440410020064101fc0800002004200541002d00001007200541016a2105200641016a2106200741016b21070c010b0b1001210320034100200410094115200120002003101026000b02404100210541e10221064108210710012103200341002007100720022003100f2104034020070440410020064101fc0800002004200541002d00001007200541016a2105200641016a2106200741016b21070c010b0b1001210320034100200410094116200120002003101026000b02404100210541e90221064106210710012103200341002007100720022003100f2104034020070440410020064101fc0800002004200541002d00001007200541016a2105200641016a2106200741016b21070c010b0b1001210320034100200410094117200120002003101026000b02404100210541ef0221064106210710012103200341002007100720022003100f2104034020070440410020064101fc0800002004200541002d00001007200541016a2105200641016a2106200741016b21070c010b0b1001210320034100200410094118200120002003101026000b02404100210541f50221064106210710012103200341002007100720022003100f2104034020070440410020064101fc0800002004200541002d00001007200541016a2105200641016a2106200741016b21070c010b0b1001210320034100200410094119200120002003101026000b02404100210541fb0221064107210710012103200341002007100720022003100f2104034020070440410020064101fc0800002004200541002d00001007200541016a2105200641016a2106200741016b21070c010b0b100121032003410020041009411a200120002003101026000b0b02400240410b230041132500100b41122500100b411a2500100b26000b0240410c230041192500100b26000b0240410d230041182500100b41122500100b41162500100b26000b0240410e230041172500100b41122500100b41162500100b26000b0240410f230041152500100b41122500100b41142500100b26000b02404110230041132500100b41122500100b41112500100b26000b0b3602000110260b0b86030101820382010000676924312d24322d24332d24342d24355e285b612d66302d395d7b387d29285b612d66302d395d7b347d29285b612d66302d395d7b347d29285b612d66302d395d7b347d29285b612d66302d395d7b31327d292430782431283f3a5b612d66302d395d7b31367d29285b612d66302d395d7b31367d29285b612d66302d395d7b307d3f29283f3a5b612d66302d395d7b387d29285b612d66302d395d7b387d29283f3a5b612d66302d395d7b31367d29283f3a5b612d66302d395d7b347d29285b612d66302d395d7b347d29283f3a5b612d66302d395d7b32347d29283f3a5b612d66302d395d7b327d29285b612d66302d395d7b327d29283f3a5b612d66302d395d7b32387d29283f3a5b612d66302d395d7b307d29285b612d66302d395d7b327d29283f3a5b612d66302d395d7b33307d295b5e612d66302d395d706164537461727470726f746f74797065537472696e676a6f696e4172726179746f537472696e674e756d626572426967496e745265674578707265706c616365`.match(/../g), $ => parseInt($, 16));
37
- return WebAssembly.instantiate(wasm, self).then(i => i.instance.exports);
36
+ return WebAssembly.instantiateStreaming(fetch("uuid.wasm"), self).then(i => console.log(i) || i.instance.exports);
38
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turbouuid",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Fast uuid generator / an alternative for crypto.randomUUID",
5
5
  "keywords": [
6
6
  "uuid"
@@ -19,5 +19,8 @@
19
19
  "main": "index.js",
20
20
  "scripts": {
21
21
  "test": "echo \"Error: no test specified\" && exit 1"
22
+ },
23
+ "dependencies": {
24
+ "wat4wasm": "^1.1.4"
22
25
  }
23
- }
26
+ }
package/src/uuid.wat CHANGED
@@ -182,18 +182,16 @@
182
182
  )
183
183
  )
184
184
 
185
- (call $apply_regexp
186
- (call $join_array<ext>ext
187
- (array $of<ext.ext.ext.ext.ext>ext
188
- (call $to_string<i32.i32>ext (i32.load8_u $i8a (i32x4.extract_lane 0 (local.get $offsets))) (i32.const 2))
189
- (call $to_string<i32.i32>ext (i32.load8_u $i8b (i32x4.extract_lane 0 (local.get $offsets))) (i32.const 2))
190
- (call $to_string<i32.i32>ext (i32.load16_u $i16 (i32x4.extract_lane 1 (local.get $offsets))) (i32.const 4))
191
- (call $to_string<i32.i32>ext (i32.load $i32 (i32x4.extract_lane 2 (local.get $offsets))) (i32.const 8))
192
- (call $to_string<i32.i64>ext (i64.load $i64 (i32x4.extract_lane 3 (local.get $offsets))) (i32.const 16))
193
- )
185
+ (call $join_array<ext>ext
186
+ (array $of<ext.ext.ext.ext.ext>ext
187
+ (call $to_string<i32.i32>ext (i32.load8_u $i8a (i32x4.extract_lane 0 (local.get $offsets))) (i32.const 2))
188
+ (call $to_string<i32.i32>ext (i32.load8_u $i8b (i32x4.extract_lane 0 (local.get $offsets))) (i32.const 2))
189
+ (call $to_string<i32.i32>ext (i32.load16_u $i16 (i32x4.extract_lane 1 (local.get $offsets))) (i32.const 4))
190
+ (call $to_string<i32.i32>ext (i32.load $i32 (i32x4.extract_lane 2 (local.get $offsets))) (i32.const 8))
191
+ (call $to_string<i32.i64>ext (i64.load $i64 (i32x4.extract_lane 3 (local.get $offsets))) (i32.const 16))
194
192
  )
195
- (global.get $ARGUMENTS_REGEXP_TO_STRING)
196
193
  )
194
+
197
195
  )
198
196
 
199
197
  (func $get_vector_index
@@ -304,17 +302,17 @@
304
302
  )
305
303
  )
306
304
 
307
- (func $main
308
- (i32.store (global.get $OFFSET_UUID_COUNT) (i32.const 0))
309
- (i32.store (global.get $OFFSET_BLOCK_COUNT) (i32.const 1))
310
-
305
+ (main $set_initials
311
306
  (global.set $ARGUMENTS_REGEXP_CLEAR_STR (call $regexp_args (text "[^a-f0-9]") (string)))
312
307
  (global.set $ARGUMENTS_REGEXP_MATCH_I8A (call $regexp_args (text "(?:[a-f0-9]{0})([a-f0-9]{2})(?:[a-f0-9]{30})") (text "0x$1")))
313
308
  (global.set $ARGUMENTS_REGEXP_MATCH_I8B (call $regexp_args (text "(?:[a-f0-9]{2})([a-f0-9]{2})(?:[a-f0-9]{28})") (text "0x$1")))
314
309
  (global.set $ARGUMENTS_REGEXP_MATCH_I16 (call $regexp_args (text "(?:[a-f0-9]{4})([a-f0-9]{4})(?:[a-f0-9]{24})") (text "0x$1")))
315
310
  (global.set $ARGUMENTS_REGEXP_MATCH_I32 (call $regexp_args (text "(?:[a-f0-9]{8})([a-f0-9]{8})(?:[a-f0-9]{16})") (text "0x$1")))
316
311
  (global.set $ARGUMENTS_REGEXP_MATCH_I64 (call $regexp_args (text "(?:[a-f0-9]{16})([a-f0-9]{16})([a-f0-9]{0}?)") (text "0x$1")))
317
- (global.set $ARGUMENTS_REGEXP_TO_STRING (call $regexp_args (text "^([a-f0-9]{8})([a-f0-9]{4})([a-f0-9]{4})([a-f0-9]{4})([a-f0-9]{12})$") (text "$1-$2-$3-$4-$5")))
312
+ (global.set $ARGUMENTS_REGEXP_TO_STRING (call $regexp_args (text "(.{8})(.{4})(.{4})(.{4})(.*)") (text "$1-$2-$3-$4-$5")))
313
+
314
+ (i32.store (global.get $OFFSET_UUID_COUNT) (i32.const 0))
315
+ (i32.store (global.get $OFFSET_BLOCK_COUNT) (i32.const 1))
318
316
  )
319
317
 
320
318
  (func $regexp_args
@@ -447,55 +445,55 @@
447
445
 
448
446
  (br_if $blocks (i8x16.all_true (i8x16.ne (local.get $i8b.splat) (v128.load $i8b offset=0 (local.get $offset.i8x16)))))
449
447
 
450
- (if (v128.any_true (v128.xor (local.get $i16.splat) (v128.load $i16 offset=0 (local.get $offset.i16x8))))(then
451
- (if (v128.any_true (v128.xor (local.get $i32.splat) (v128.load $i32 offset=0 (local.get $offset.i32x4))))(then
452
- (if (v128.any_true (v128.xor (local.get $i64.splat) (v128.load $i64 offset=0 (local.get $offset.i64x2))))(then
448
+ (if (v128.any_true (i16x8.eq (local.get $i16.splat) (v128.load $i16 offset=0 (local.get $offset.i16x8))))(then
449
+ (if (v128.any_true (i32x4.eq (local.get $i32.splat) (v128.load $i32 offset=0 (local.get $offset.i32x4))))(then
450
+ (if (v128.any_true (i64x2.eq (local.get $i64.splat) (v128.load $i64 offset=0 (local.get $offset.i64x2))))(then
453
451
  (if (i32.eq (i32.load8_u $i8a offset=0 (local.get $offset.i8x16)) (local.get $i8a.value))(then
454
452
  (return (i32.add (local.get $offset.i8x16) (i32.const 0)))))
455
453
  (if (i32.eq (local.get $i8a.value) (i32.load8_u $i8a offset=1 (local.get $offset.i8x16)))(then
456
454
  (return (i32.add (local.get $offset.i8x16) (i32.const 1)))))))
457
455
 
458
- (if (v128.any_true (v128.xor (local.get $i64.splat) (v128.load $i64 offset=16 (local.get $offset.i64x2))))(then
456
+ (if (v128.any_true (i64x2.eq (local.get $i64.splat) (v128.load $i64 offset=16 (local.get $offset.i64x2))))(then
459
457
  (if (i32.eq (local.get $i8a.value) (i32.load8_u $i8a offset=2 (local.get $offset.i8x16)))(then
460
458
  (return (i32.add (local.get $offset.i8x16) (i32.const 2)))))
461
459
  (if (i32.eq (local.get $i8a.value) (i32.load8_u $i8a offset=3 (local.get $offset.i8x16)))(then
462
460
  (return (i32.add (local.get $offset.i8x16) (i32.const 3)))))))))
463
461
 
464
- (if (v128.any_true (v128.xor (local.get $i32.splat) (v128.load $i32 offset=16 (local.get $offset.i32x4))))(then
465
- (if (v128.any_true (v128.xor (local.get $i64.splat) (v128.load $i64 offset=32 (local.get $offset.i64x2))))(then
462
+ (if (v128.any_true (i32x4.eq (local.get $i32.splat) (v128.load $i32 offset=16 (local.get $offset.i32x4))))(then
463
+ (if (v128.any_true (i64x2.eq (local.get $i64.splat) (v128.load $i64 offset=32 (local.get $offset.i64x2))))(then
466
464
  (if (i32.eq (local.get $i8a.value) (i32.load8_u $i8a offset=4 (local.get $offset.i8x16)))(then
467
465
  (return (i32.add (local.get $offset.i8x16) (i32.const 4)))))
468
466
  (if (i32.eq (local.get $i8a.value) (i32.load8_u $i8a offset=5 (local.get $offset.i8x16)))(then
469
467
  (return (i32.add (local.get $offset.i8x16) (i32.const 5)))))))
470
468
 
471
- (if (v128.any_true (v128.xor (local.get $i64.splat) (v128.load $i64 offset=48 (local.get $offset.i64x2))))(then
469
+ (if (v128.any_true (i64x2.eq (local.get $i64.splat) (v128.load $i64 offset=48 (local.get $offset.i64x2))))(then
472
470
  (if (i32.eq (local.get $i8a.value) (i32.load8_u $i8a offset=6 (local.get $offset.i8x16)))(then
473
471
  (return (i32.add (local.get $offset.i8x16) (i32.const 6)))))
474
472
  (if (i32.eq (local.get $i8a.value) (i32.load8_u $i8a offset=7 (local.get $offset.i8x16)))(then
475
473
  (return (i32.add (local.get $offset.i8x16) (i32.const 7)))))))))))
476
474
 
477
- (if (v128.any_true (v128.xor (local.get $i16.splat) (v128.load $i16 offset=16 (local.get $offset.i16x8))))(then
478
- (if (v128.any_true (v128.xor (local.get $i32.splat) (v128.load $i32 offset=32 (local.get $offset.i32x4))))(then
479
- (if (v128.any_true (v128.xor (local.get $i64.splat) (v128.load $i64 offset=64 (local.get $offset.i64x2))))(then
475
+ (if (v128.any_true (i16x8.eq (local.get $i16.splat) (v128.load $i16 offset=16 (local.get $offset.i16x8))))(then
476
+ (if (v128.any_true (i32x4.eq (local.get $i32.splat) (v128.load $i32 offset=32 (local.get $offset.i32x4))))(then
477
+ (if (v128.any_true (i64x2.eq (local.get $i64.splat) (v128.load $i64 offset=64 (local.get $offset.i64x2))))(then
480
478
  (if (i32.eq (local.get $i8a.value) (i32.load8_u $i8a offset=8 (local.get $offset.i8x16)))(then
481
479
  (return (i32.add (local.get $offset.i8x16) (i32.const 8)))))
482
480
  (if (i32.eq (local.get $i8a.value) (i32.load8_u $i8a offset=9 (local.get $offset.i8x16)))(then
483
481
  (return (i32.add (local.get $offset.i8x16) (i32.const 9)))))))
484
482
 
485
- (if (v128.any_true (v128.xor (local.get $i64.splat) (v128.load $i64 offset=80 (local.get $offset.i64x2))))(then
483
+ (if (v128.any_true (i64x2.eq (local.get $i64.splat) (v128.load $i64 offset=80 (local.get $offset.i64x2))))(then
486
484
  (if (i32.eq (local.get $i8a.value) (i32.load8_u $i8a offset=10 (local.get $offset.i8x16)))(then
487
485
  (return (i32.add (local.get $offset.i8x16) (i32.const 10)))))
488
486
  (if (i32.eq (local.get $i8a.value) (i32.load8_u $i8a offset=11 (local.get $offset.i8x16)))(then
489
487
  (return (i32.add (local.get $offset.i8x16) (i32.const 11)))))))))
490
488
 
491
- (if (v128.any_true (v128.xor (local.get $i32.splat) (v128.load $i32 offset=48 (local.get $offset.i32x4))))(then
492
- (if (v128.any_true (v128.xor (local.get $i64.splat) (v128.load $i64 offset=96 (local.get $offset.i64x2))))(then
489
+ (if (v128.any_true (i32x4.eq (local.get $i32.splat) (v128.load $i32 offset=48 (local.get $offset.i32x4))))(then
490
+ (if (v128.any_true (i64x2.eq (local.get $i64.splat) (v128.load $i64 offset=96 (local.get $offset.i64x2))))(then
493
491
  (if (i32.eq (local.get $i8a.value) (i32.load8_u $i8a offset=12 (local.get $offset.i8x16)))(then
494
492
  (return (i32.add (local.get $offset.i8x16) (i32.const 12)))))
495
493
  (if (i32.eq (local.get $i8a.value) (i32.load8_u $i8a offset=13 (local.get $offset.i8x16)))(then
496
494
  (return (i32.add (local.get $offset.i8x16) (i32.const 13)))))))
497
495
 
498
- (if (v128.any_true (v128.xor (local.get $i64.splat) (v128.load $i64 offset=112 (local.get $offset.i64x2))))(then
496
+ (if (v128.any_true (i64x2.eq (local.get $i64.splat) (v128.load $i64 offset=112 (local.get $offset.i64x2))))(then
499
497
  (if (i32.eq (local.get $i8a.value) (i32.load8_u $i8a offset=14 (local.get $offset.i8x16)))(then
500
498
  (return (i32.add (local.get $offset.i8x16) (i32.const 14)))))
501
499
 
@@ -509,6 +507,4 @@
509
507
 
510
508
  (i32.const -1)
511
509
  )
512
-
513
- (start $main)
514
510
  )
package/test.html ADDED
@@ -0,0 +1,40 @@
1
+ <script type="module">
2
+ import "./index.js"
3
+
4
+ turboUUID.base().then(base => {
5
+ console.warn(self.base = base)
6
+
7
+ self.array = new Array();
8
+ let count, uuid, value;
9
+
10
+ count = 32768000;
11
+ while (count--) {
12
+ uuid = base.randomUUID();;
13
+ array.push(uuid);
14
+ }
15
+
16
+ console.log({ array })
17
+
18
+ console.log("ready")
19
+ new BroadcastChannel("uuid").onmessage = e => {
20
+ const uuid = e.data;
21
+ console.warn(uuid)
22
+
23
+ const t0 = performance.now();
24
+ const vm = array.indexOf(uuid);
25
+ const tm = performance.now() - t0;
26
+
27
+ const t1 = performance.now();
28
+ const vb = base.indexOf(uuid);
29
+ const tb = performance.now() - t1;
30
+
31
+ console.warn({ array: tm, vm, base: tb, vb })
32
+
33
+ performance.clearMarks();
34
+ performance.clearMeasures();
35
+ performance.clearResourceTimings();
36
+ }
37
+
38
+
39
+ })
40
+ </script>
package/uuid.wasm ADDED
Binary file