@tamagui/timer 1.116.1 → 1.116.2
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.
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
+
var src_exports = {};
|
|
16
|
+
__export(src_exports, {
|
|
17
|
+
timer: () => timer
|
|
18
|
+
});
|
|
19
|
+
module.exports = __toCommonJS(src_exports);
|
|
20
|
+
function timer() {
|
|
21
|
+
let runs = 0;
|
|
22
|
+
const typesOfRuns = /* @__PURE__ */ new Set(), timings = {};
|
|
23
|
+
function print() {
|
|
24
|
+
const typeRuns = runs / typesOfRuns.size;
|
|
25
|
+
let totalTime = 0;
|
|
26
|
+
const out = [
|
|
27
|
+
`Ran ${typeRuns} per-type, ${runs} total`,
|
|
28
|
+
...[...typesOfRuns].map((name) => {
|
|
29
|
+
const avg = `avg ${`${timings[name] / typeRuns}`.slice(0, 9).padEnd(9)}ms`, total = timings[name];
|
|
30
|
+
return totalTime += total, `${name.slice(0, 30).padStart(31)} | ${avg} | total ${total}ms`;
|
|
31
|
+
}),
|
|
32
|
+
` total ${totalTime}ms`
|
|
33
|
+
].join(`
|
|
34
|
+
`);
|
|
35
|
+
return console.info(out), out;
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
start(opts) {
|
|
39
|
+
const quiet = opts?.quiet ?? !0;
|
|
40
|
+
function time(strings, ...vars) {
|
|
41
|
+
const elapsed = performance.now() - start;
|
|
42
|
+
start = performance.now();
|
|
43
|
+
const tag = strings[0];
|
|
44
|
+
if (typesOfRuns.add(tag), runs++, timings[tag] ??= 0, timings[tag] += elapsed, !quiet) {
|
|
45
|
+
let result = "";
|
|
46
|
+
strings.forEach((str, i) => {
|
|
47
|
+
result += `${str}${i === strings.length - 1 ? "" : vars[i]}`;
|
|
48
|
+
}), console.info(`${`${elapsed}ms`.slice(0, 6).padStart(7)} |`, result);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
let start = performance.now();
|
|
52
|
+
return time.print = print, time;
|
|
53
|
+
},
|
|
54
|
+
profile() {
|
|
55
|
+
return {
|
|
56
|
+
timings,
|
|
57
|
+
runs
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
print
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/timer",
|
|
3
|
-
"version": "1.116.
|
|
3
|
+
"version": "1.116.2",
|
|
4
4
|
"types": "./types/index.d.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"clean:build": "tamagui-build clean:build"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@tamagui/build": "1.116.
|
|
21
|
+
"@tamagui/build": "1.116.2"
|
|
22
22
|
},
|
|
23
23
|
"exports": {
|
|
24
24
|
"./package.json": "./package.json",
|
|
File without changes
|