Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@callstack/reassure-measure

Package Overview
Dependencies
Maintainers
11
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@callstack/reassure-measure - npm Package Compare versions

Comparing version 1.0.0-rc.3 to 1.0.0-rc.4

6

lib/commonjs/measure-function.js

@@ -13,3 +13,3 @@ "use strict";

const stats = await measureFunctionInternal(fn, options);
if ((options === null || options === void 0 ? void 0 : options.writeFile) !== false) {
if (options?.writeFile !== false) {
await (0, _output.writeTestStats)(stats, 'function');

@@ -20,4 +20,4 @@ }

function measureFunctionInternal(fn, options) {
const runs = (options === null || options === void 0 ? void 0 : options.runs) ?? _config.config.runs;
const warmupRuns = (options === null || options === void 0 ? void 0 : options.warmupRuns) ?? _config.config.warmupRuns;
const runs = options?.runs ?? _config.config.runs;
const warmupRuns = options?.warmupRuns ?? _config.config.warmupRuns;
(0, _output.showFlagsOutputIfNeeded)();

@@ -24,0 +24,0 @@ const runResults = [];

@@ -10,9 +10,9 @@ "use strict";

function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function processRunResults(results, warmupRuns) {
results = results.slice(warmupRuns);
results.sort((first, second) => second.duration - first.duration); // duration DESC
function processRunResults(inputResults, warmupRuns) {
const warmupResults = inputResults.slice(0, warmupRuns);
const results = inputResults.slice(warmupRuns);
const durations = results.map(result => result.duration);
const meanDuration = math.mean(durations);
const stdevDuration = math.std(...durations);
const warmupDurations = warmupResults.map(result => result.duration);
const counts = results.map(result => result.count);

@@ -26,2 +26,3 @@ const meanCount = math.mean(counts);

durations,
warmupDurations,
meanCount,

@@ -28,0 +29,0 @@ stdevCount,

@@ -23,3 +23,3 @@ "use strict";

const stats = await measureRendersInternal(ui, options);
if ((options === null || options === void 0 ? void 0 : options.writeFile) !== false) {
if (options?.writeFile !== false) {
await (0, _output.writeTestStats)(stats, 'render');

@@ -38,5 +38,5 @@ }

async function measureRendersInternal(ui, options) {
const runs = (options === null || options === void 0 ? void 0 : options.runs) ?? _config.config.runs;
const scenario = options === null || options === void 0 ? void 0 : options.scenario;
const warmupRuns = (options === null || options === void 0 ? void 0 : options.warmupRuns) ?? _config.config.warmupRuns;
const runs = options?.runs ?? _config.config.runs;
const scenario = options?.scenario;
const warmupRuns = options?.warmupRuns ?? _config.config.warmupRuns;
const {

@@ -50,3 +50,2 @@ render,

for (let i = 0; i < runs + warmupRuns; i += 1) {
var _global$gc, _global;
let duration = 0;

@@ -62,3 +61,3 @@ let count = 0;

};
const uiToRender = buildUiToRender(ui, handleRender, options === null || options === void 0 ? void 0 : options.wrapper);
const uiToRender = buildUiToRender(ui, handleRender, options?.wrapper);
const screen = render(uiToRender);

@@ -70,3 +69,3 @@ if (scenario) {

isFinished = true;
(_global$gc = (_global = global).gc) === null || _global$gc === void 0 || _global$gc.call(_global);
global.gc?.();
runResults.push({

@@ -73,0 +72,0 @@ duration,

@@ -7,3 +7,3 @@ import { performance } from 'perf_hooks';

const stats = await measureFunctionInternal(fn, options);
if ((options === null || options === void 0 ? void 0 : options.writeFile) !== false) {
if (options?.writeFile !== false) {
await writeTestStats(stats, 'function');

@@ -14,4 +14,4 @@ }

function measureFunctionInternal(fn, options) {
const runs = (options === null || options === void 0 ? void 0 : options.runs) ?? config.runs;
const warmupRuns = (options === null || options === void 0 ? void 0 : options.warmupRuns) ?? config.warmupRuns;
const runs = options?.runs ?? config.runs;
const warmupRuns = options?.warmupRuns ?? config.warmupRuns;
showFlagsOutputIfNeeded();

@@ -18,0 +18,0 @@ const runResults = [];

import * as math from 'mathjs';
export function processRunResults(results, warmupRuns) {
results = results.slice(warmupRuns);
results.sort((first, second) => second.duration - first.duration); // duration DESC
export function processRunResults(inputResults, warmupRuns) {
const warmupResults = inputResults.slice(0, warmupRuns);
const results = inputResults.slice(warmupRuns);
const durations = results.map(result => result.duration);
const meanDuration = math.mean(durations);
const stdevDuration = math.std(...durations);
const warmupDurations = warmupResults.map(result => result.duration);
const counts = results.map(result => result.count);

@@ -17,2 +17,3 @@ const meanCount = math.mean(counts);

durations,
warmupDurations,
meanCount,

@@ -19,0 +20,0 @@ stdevCount,

@@ -13,3 +13,3 @@ import * as React from 'react';

const stats = await measureRendersInternal(ui, options);
if ((options === null || options === void 0 ? void 0 : options.writeFile) !== false) {
if (options?.writeFile !== false) {
await writeTestStats(stats, 'render');

@@ -28,5 +28,5 @@ }

async function measureRendersInternal(ui, options) {
const runs = (options === null || options === void 0 ? void 0 : options.runs) ?? config.runs;
const scenario = options === null || options === void 0 ? void 0 : options.scenario;
const warmupRuns = (options === null || options === void 0 ? void 0 : options.warmupRuns) ?? config.warmupRuns;
const runs = options?.runs ?? config.runs;
const scenario = options?.scenario;
const warmupRuns = options?.warmupRuns ?? config.warmupRuns;
const {

@@ -40,3 +40,2 @@ render,

for (let i = 0; i < runs + warmupRuns; i += 1) {
var _global$gc, _global;
let duration = 0;

@@ -52,3 +51,3 @@ let count = 0;

};
const uiToRender = buildUiToRender(ui, handleRender, options === null || options === void 0 ? void 0 : options.wrapper);
const uiToRender = buildUiToRender(ui, handleRender, options?.wrapper);
const screen = render(uiToRender);

@@ -60,3 +59,3 @@ if (scenario) {

isFinished = true;
(_global$gc = (_global = global).gc) === null || _global$gc === void 0 || _global$gc.call(_global);
global.gc?.();
runResults.push({

@@ -63,0 +62,0 @@ duration,

@@ -6,2 +6,3 @@ export { configure, resetToDefaults } from './config';

export type { MeasureFunctionOptions } from './measure-function';
export type { MeasureType, MeasureResults } from './types';
//# sourceMappingURL=index.d.ts.map

@@ -6,3 +6,3 @@ import type { MeasureResults } from './types';

}
export declare function processRunResults(results: RunResult[], warmupRuns: number): MeasureResults;
export declare function processRunResults(inputResults: RunResult[], warmupRuns: number): MeasureResults;
//# sourceMappingURL=measure-helpers.d.ts.map

@@ -15,2 +15,4 @@ /** Type of measured performance characteristic. */

durations: number[];
/** Array of measured render/execution durations for each warmup run */
warmupDurations: number[];
/** Arithmetic average of measured render/execution count for each run */

@@ -17,0 +19,0 @@ meanCount: number;

{
"name": "@callstack/reassure-measure",
"version": "1.0.0-rc.3",
"version": "1.0.0-rc.4",
"description": "Performance measurement library for React and React Native",

@@ -17,3 +17,4 @@ "main": "lib/commonjs/index.js",

"test": "jest",
"build": "bob build"
"build": "bob build",
"clean": "del lib"
},

@@ -38,18 +39,19 @@ "keywords": [

"dependencies": {
"@callstack/reassure-logger": "1.0.0-rc.3",
"mathjs": "^12.3.2"
"@callstack/reassure-logger": "1.0.0-rc.4",
"mathjs": "^12.4.2"
},
"devDependencies": {
"@babel/core": "^7.23.7",
"@babel/plugin-transform-flow-strip-types": "^7.23.3",
"@babel/preset-env": "^7.23.7",
"@babel/preset-react": "^7.23.7",
"@babel/preset-typescript": "^7.23.3",
"@babel/runtime": "^7.23.7",
"@babel/core": "^7.24.5",
"@babel/plugin-transform-flow-strip-types": "^7.24.1",
"@babel/preset-env": "^7.24.5",
"@babel/preset-react": "^7.24.1",
"@babel/preset-typescript": "^7.24.1",
"@babel/runtime": "^7.24.5",
"@relmify/jest-serializer-strip-ansi": "^1.0.2",
"@testing-library/react": "^14.1.2",
"@testing-library/react-native": "^12.4.3",
"@types/jest": "^29.5.11",
"@testing-library/react": "^15.0.7",
"@testing-library/react-native": "^12.5.0",
"@types/jest": "^29.5.12",
"@types/react": "^18.2.46",
"babel-jest": "^29.7.0",
"del-cli": "^5.1.0",
"jest": "^29.7.0",

@@ -59,10 +61,10 @@ "prettier": "^2.8.8",

"react-dom": "18.2.0",
"react-native": "0.73.1",
"react-native-builder-bob": "^0.20.3",
"react-native": "0.74.1",
"react-native-builder-bob": "^0.23.2",
"react-test-renderer": "18.2.0",
"strip-ansi": "^6.0.1",
"typescript": "^5.2.2"
"typescript": "^5.4.5"
},
"peerDependencies": {
"react": ">=17.0.0"
"react": ">=18.0.0"
},

@@ -69,0 +71,0 @@ "react-native-builder-bob": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc