Files
discord-decomp/sources/modules/profiling/ComponentProfiler.tsx
T
2026-07-27 16:20:00 +03:00

187 lines
7.8 KiB
TypeScript

/* Metro module 11222; source: modules/profiling/ComponentProfiler.tsx; dependencies: [6, 7, 31, 33, 2] */
function _fun85775(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#85775, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11408:6, offset: 0x01f7b755, size: 297 bytes, params: 8, frame: 20
const formatString = function(a0, a1) {
var value = a1;
return a0.substring(0, a0.length > value ? value : a0.length).padEnd(value, ' ');
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_0 = importDefault(6) /* metro dependency 6 */;
const env0_1 = importDefault(7) /* metro dependency 7 */;
const env0_2 = importAll(31) /* metro dependency 31 */;
const env0_3 = (require(33) /* metro dependency 33 */).jsx;
let value = _fun85777();
let env0_5 = {};
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/profiling/ComponentProfiler.tsx');
exports.default = ComponentProfiler;
exports.StatCollector = value;
exports.clearComponentRenderStats = function() {
env0_5 = {};
};
exports.getComponentRenderStats = getComponentRenderStats;
exports.serializeComponentRenderAverages = serializeComponentRenderAverages;
exports.resetComponentProfiler = function() {
env0_5 = {};
};
exports.pauseComponentProfiler = function() {
env0_6 = false;
};
exports.resumeComponentProfiler = function() {
env0_6 = true;
};
exports.dumpStats = dumpStats;
}
function _fun85777() { // fn#85777, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11408:142, offset: 0x01f7b8b7, size: 84 bytes, params: 1, frame: 15
return env0_1(StatCollector, [{key: 'addValue', value: value_85779}, {key: 'mean', get: function() {
return this.totalMicroseconds / this.count;
}}]);
}
function ComponentProfiler({id, children}) { // fn#85781, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11408:851, offset: 0x01f7b9f6, size: 79 bytes, params: 2, frame: 16
const binding = env0_2;
const value2 = binding.useCallback(_fun85782, []);
const Profiler = binding.Profiler;
return (
<Profiler id={id} onRender={value2}>
{children}
</Profiler>
);
}
function serializeComponentRenderAverages() { // fn#85785, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11408:1391, offset: 0x01f7bb2c, size: 242 bytes, params: 1, frame: 34
var r0;
var formatStringBinding;
var value11;
const Object = global.Object;
const keys = Object.keys;
var value;
if (Reflect.apply(keys, Object, [env0_5]).length === 0) {
r0 = '';
} else {
formatStringBinding = formatString;
value11 = 'Component Render Stats (microseconds):\n' + ('|' + formatStringBinding('id',
20) + '|' + formatStringBinding('Mounts', 8) + '|' + formatStringBinding('Mount Mean',
20) + '|' + formatStringBinding('Updates', 8) + '|' + formatStringBinding('Update Mean',
20) + '|' + formatStringBinding('Nested', 8) + '|' + formatStringBinding('Nested Mean', 20) + '|\n');
value = global.Object.entries(env0_5);
value = value11 + value.map(_fun85786);
r0 = value;
}
return r0;
}
function StatCollector() { // fn#85778, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11408:163, offset: 0x01f7b90b, size: 55 bytes, params: 1, frame: 13
env1_0(this, StatCollector);
this.totalMicroseconds = 0;
this.count = 0;
this.minMicroseconds = null;
this.maxMicroseconds = null;
}
function value_85779(a0) { // fn#85779, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11408:325, offset: 0x01f7b942, size: 160 bytes, params: 2, frame: 17
const count = this.count;
this.count = typeof count === 'bigint' ? count + 1n : +count + 1;
let Math = global.Math;
const value = Math.round(1000 * a0);
this.totalMicroseconds = this.totalMicroseconds + value;
Math = global.Math;
this.minMicroseconds = Math.min(this.minMicroseconds ?? global.Number.MAX_SAFE_INTEGER, value);
Math = global.Math;
this.maxMicroseconds = Math.max(this.maxMicroseconds ?? global.Number.MIN_SAFE_INTEGER, value);
}
function _fun85782(a0, a1, a2) { // fn#85782, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11408:918, offset: 0x01f7ba45, size: 231 bytes, params: 4, frame: 17
var binding;
var object2;
var binding2;
var prototype;
var value2;
var binding22;
var value5;
var binding23;
var value8;
var binding24;
if (env1_6) {
if (!(a0 in env1_5)) {
binding = env1_5;
object2 = {};
binding2 = env1_4;
prototype = binding2.prototype;
value2 = Object.create(prototype, {constructor: {value: binding2}});
binding22 = new binding2();
object2.mount = binding22 instanceof Object ? binding22 : value2;
prototype = binding2.prototype;
value5 = Object.create(prototype, {constructor: {value: binding2}});
binding23 = new binding2();
object2.update = binding23 instanceof Object ? binding23 : value5;
prototype = binding2.prototype;
value8 = Object.create(prototype, {constructor: {value: binding2}});
binding24 = new binding2();
object2.nestedUpdate = binding24 instanceof Object ? binding24 : value8;
binding[a0] = object2;
}
if (a1 === 'mount') {
env1_5[a0].mount.addValue(a2);
} else if (a1 === 'update') {
env1_5[a0].update.addValue(a2);
} else if (a1 === 'nested-update') {
env1_5[a0].nestedUpdate.addValue(a2);
}
}
}
function _fun85786(a0) { // fn#85786, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11408:1754, offset: 0x01f7bc1e, size: 294 bytes, params: 2, frame: 33
var r0;
var r1;
var r2;
var item3;
var value3;
const iterator = a0[Symbol.iterator]();
const iterator2 = iterator.next;
let item2 = Reflect.apply(iterator2, iterator, []);
let item = item2.value;
item2 = item2.done ? undefined : iterator;
const value = undefined;
const value2 = item2 === value;
const r4 = value2 ? value : item;
if (value2) {
r0 = value;
r1 = item2;
r2 = value2;
} else {
item3 = Reflect.apply(iterator2, item2, []);
item = item3.value;
item3 = item3.done ? undefined : item2;
value3 = item3 === value;
if (value3) {
r0 = value;
r1 = item3;
r2 = value3;
} else {
r0 = item;
r1 = item3;
r2 = value3;
}
}
if (!r2) {
r1.return();
}
const formatStringBinding = formatString;
const value5 = formatStringBinding(r4, 20);
let count = r0.mount.count;
const value7 = formatStringBinding(count.toString(), 8);
let mean = r0.mount.mean;
const value8 = formatStringBinding(mean.toString(), 20);
count = r0.update.count;
const value9 = formatStringBinding(count.toString(), 8);
mean = r0.update.mean;
const value10 = formatStringBinding(mean.toString(), 20);
count = r0.nestedUpdate.count;
const value11 = formatStringBinding(count.toString(), 8);
mean = r0.nestedUpdate.mean;
return '|' + value5 + '|' + value7 + '|' + value8 + '|' + value9 + '|' + value10 + '|' + value11 + '|' + formatStringBinding(mean.toString(),
20) + '|\n';
}