@skillsmith/core 0.1.2 → 0.2.0
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/dist/.tsbuildinfo +1 -1
- package/dist/src/analysis/CodebaseAnalyzer.d.ts +4 -134
- package/dist/src/analysis/CodebaseAnalyzer.d.ts.map +1 -1
- package/dist/src/analysis/CodebaseAnalyzer.js +7 -315
- package/dist/src/analysis/CodebaseAnalyzer.js.map +1 -1
- package/dist/src/analysis/framework-detector.d.ts +47 -0
- package/dist/src/analysis/framework-detector.d.ts.map +1 -0
- package/dist/src/analysis/framework-detector.js +151 -0
- package/dist/src/analysis/framework-detector.js.map +1 -0
- package/dist/src/analysis/index.d.ts +6 -1
- package/dist/src/analysis/index.d.ts.map +1 -1
- package/dist/src/analysis/index.js +10 -1
- package/dist/src/analysis/index.js.map +1 -1
- package/dist/src/analysis/parsers.d.ts +43 -0
- package/dist/src/analysis/parsers.d.ts.map +1 -0
- package/dist/src/analysis/parsers.js +219 -0
- package/dist/src/analysis/parsers.js.map +1 -0
- package/dist/src/analysis/types.d.ts +138 -0
- package/dist/src/analysis/types.d.ts.map +1 -0
- package/dist/src/analysis/types.js +25 -0
- package/dist/src/analysis/types.js.map +1 -0
- package/dist/src/analytics/AnalyticsRepository.d.ts.map +1 -1
- package/dist/src/analytics/AnalyticsRepository.js +4 -4
- package/dist/src/analytics/AnalyticsRepository.js.map +1 -1
- package/dist/src/api/cache.d.ts +108 -0
- package/dist/src/api/cache.d.ts.map +1 -0
- package/dist/src/api/cache.js +216 -0
- package/dist/src/api/cache.js.map +1 -0
- package/dist/src/api/client.d.ts +152 -0
- package/dist/src/api/client.d.ts.map +1 -0
- package/dist/src/api/client.js +221 -0
- package/dist/src/api/client.js.map +1 -0
- package/dist/src/api/index.d.ts +10 -0
- package/dist/src/api/index.d.ts.map +1 -0
- package/dist/src/api/index.js +10 -0
- package/dist/src/api/index.js.map +1 -0
- package/dist/src/benchmarks/BenchmarkRunner.d.ts +6 -175
- package/dist/src/benchmarks/BenchmarkRunner.d.ts.map +1 -1
- package/dist/src/benchmarks/BenchmarkRunner.js +6 -123
- package/dist/src/benchmarks/BenchmarkRunner.js.map +1 -1
- package/dist/src/benchmarks/MemoryProfiler.d.ts +4 -262
- package/dist/src/benchmarks/MemoryProfiler.d.ts.map +1 -1
- package/dist/src/benchmarks/MemoryProfiler.js +4 -400
- package/dist/src/benchmarks/MemoryProfiler.js.map +1 -1
- package/dist/src/benchmarks/comparator.d.ts +38 -0
- package/dist/src/benchmarks/comparator.d.ts.map +1 -0
- package/dist/src/benchmarks/comparator.js +81 -0
- package/dist/src/benchmarks/comparator.js.map +1 -0
- package/dist/src/benchmarks/formatters.d.ts +30 -0
- package/dist/src/benchmarks/formatters.d.ts.map +1 -0
- package/dist/src/benchmarks/formatters.js +88 -0
- package/dist/src/benchmarks/formatters.js.map +1 -0
- package/dist/src/benchmarks/index.d.ts +5 -1
- package/dist/src/benchmarks/index.d.ts.map +1 -1
- package/dist/src/benchmarks/index.js +9 -2
- package/dist/src/benchmarks/index.js.map +1 -1
- package/dist/src/benchmarks/memory/MemoryProfiler.d.ts +165 -0
- package/dist/src/benchmarks/memory/MemoryProfiler.d.ts.map +1 -0
- package/dist/src/benchmarks/memory/MemoryProfiler.js +312 -0
- package/dist/src/benchmarks/memory/MemoryProfiler.js.map +1 -0
- package/dist/src/benchmarks/memory/baseline-manager.d.ts +64 -0
- package/dist/src/benchmarks/memory/baseline-manager.d.ts.map +1 -0
- package/dist/src/benchmarks/memory/baseline-manager.js +95 -0
- package/dist/src/benchmarks/memory/baseline-manager.js.map +1 -0
- package/dist/src/benchmarks/memory/index.d.ts +12 -0
- package/dist/src/benchmarks/memory/index.d.ts.map +1 -0
- package/dist/src/benchmarks/memory/index.js +12 -0
- package/dist/src/benchmarks/memory/index.js.map +1 -0
- package/dist/src/benchmarks/memory/leak-detector.d.ts +23 -0
- package/dist/src/benchmarks/memory/leak-detector.d.ts.map +1 -0
- package/dist/src/benchmarks/memory/leak-detector.js +46 -0
- package/dist/src/benchmarks/memory/leak-detector.js.map +1 -0
- package/dist/src/benchmarks/memory/regression-detector.d.ts +17 -0
- package/dist/src/benchmarks/memory/regression-detector.d.ts.map +1 -0
- package/dist/src/benchmarks/memory/regression-detector.js +56 -0
- package/dist/src/benchmarks/memory/regression-detector.js.map +1 -0
- package/dist/src/benchmarks/memory/types.d.ts +111 -0
- package/dist/src/benchmarks/memory/types.d.ts.map +1 -0
- package/dist/src/benchmarks/memory/types.js +7 -0
- package/dist/src/benchmarks/memory/types.js.map +1 -0
- package/dist/src/benchmarks/memory/utils.d.ts +17 -0
- package/dist/src/benchmarks/memory/utils.d.ts.map +1 -0
- package/dist/src/benchmarks/memory/utils.js +29 -0
- package/dist/src/benchmarks/memory/utils.js.map +1 -0
- package/dist/src/benchmarks/types.d.ts +175 -0
- package/dist/src/benchmarks/types.d.ts.map +1 -0
- package/dist/src/benchmarks/types.js +20 -0
- package/dist/src/benchmarks/types.js.map +1 -0
- package/dist/src/index.d.ts +4 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +7 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/repositories/QuarantineRepository.d.ts +4 -251
- package/dist/src/repositories/QuarantineRepository.d.ts.map +1 -1
- package/dist/src/repositories/QuarantineRepository.js +4 -441
- package/dist/src/repositories/QuarantineRepository.js.map +1 -1
- package/dist/src/repositories/quarantine/QuarantineRepository.d.ts +168 -0
- package/dist/src/repositories/quarantine/QuarantineRepository.d.ts.map +1 -0
- package/dist/src/repositories/quarantine/QuarantineRepository.js +341 -0
- package/dist/src/repositories/quarantine/QuarantineRepository.js.map +1 -0
- package/dist/src/repositories/quarantine/index.d.ts +10 -0
- package/dist/src/repositories/quarantine/index.d.ts.map +1 -0
- package/dist/src/repositories/quarantine/index.js +10 -0
- package/dist/src/repositories/quarantine/index.js.map +1 -0
- package/dist/src/repositories/quarantine/queries.d.ts +58 -0
- package/dist/src/repositories/quarantine/queries.d.ts.map +1 -0
- package/dist/src/repositories/quarantine/queries.js +88 -0
- package/dist/src/repositories/quarantine/queries.js.map +1 -0
- package/dist/src/repositories/quarantine/query-builder.d.ts +44 -0
- package/dist/src/repositories/quarantine/query-builder.d.ts.map +1 -0
- package/dist/src/repositories/quarantine/query-builder.js +87 -0
- package/dist/src/repositories/quarantine/query-builder.js.map +1 -0
- package/dist/src/repositories/quarantine/types.d.ts +155 -0
- package/dist/src/repositories/quarantine/types.d.ts.map +1 -0
- package/dist/src/repositories/quarantine/types.js +13 -0
- package/dist/src/repositories/quarantine/types.js.map +1 -0
- package/dist/src/scripts/__tests__/scan-imported-skills.test.d.ts +1 -0
- package/dist/src/scripts/__tests__/scan-imported-skills.test.d.ts.map +1 -1
- package/dist/src/scripts/__tests__/scan-imported-skills.test.js +7 -43
- package/dist/src/scripts/__tests__/scan-imported-skills.test.js.map +1 -1
- package/dist/src/scripts/github-import/checkpoint.d.ts +21 -0
- package/dist/src/scripts/github-import/checkpoint.d.ts.map +1 -0
- package/dist/src/scripts/github-import/checkpoint.js +52 -0
- package/dist/src/scripts/github-import/checkpoint.js.map +1 -0
- package/dist/src/scripts/github-import/deduplication.d.ts +15 -0
- package/dist/src/scripts/github-import/deduplication.d.ts.map +1 -0
- package/dist/src/scripts/github-import/deduplication.js +33 -0
- package/dist/src/scripts/github-import/deduplication.js.map +1 -0
- package/dist/src/scripts/github-import/github-client.d.ts +29 -0
- package/dist/src/scripts/github-import/github-client.d.ts.map +1 -0
- package/dist/src/scripts/github-import/github-client.js +184 -0
- package/dist/src/scripts/github-import/github-client.js.map +1 -0
- package/dist/src/scripts/github-import/index.d.ts +29 -0
- package/dist/src/scripts/github-import/index.d.ts.map +1 -0
- package/dist/src/scripts/github-import/index.js +198 -0
- package/dist/src/scripts/github-import/index.js.map +1 -0
- package/dist/src/scripts/github-import/output.d.ts +12 -0
- package/dist/src/scripts/github-import/output.d.ts.map +1 -0
- package/dist/src/scripts/github-import/output.js +34 -0
- package/dist/src/scripts/github-import/output.js.map +1 -0
- package/dist/src/scripts/github-import/types.d.ts +108 -0
- package/dist/src/scripts/github-import/types.d.ts.map +1 -0
- package/dist/src/scripts/github-import/types.js +44 -0
- package/dist/src/scripts/github-import/types.js.map +1 -0
- package/dist/src/scripts/github-import/utils.d.ts +13 -0
- package/dist/src/scripts/github-import/utils.d.ts.map +1 -0
- package/dist/src/scripts/github-import/utils.js +28 -0
- package/dist/src/scripts/github-import/utils.js.map +1 -0
- package/dist/src/scripts/import-github-skills.d.ts +3 -12
- package/dist/src/scripts/import-github-skills.d.ts.map +1 -1
- package/dist/src/scripts/import-github-skills.js +18 -398
- package/dist/src/scripts/import-github-skills.js.map +1 -1
- package/dist/src/scripts/scan-imported-skills.d.ts +7 -7
- package/dist/src/scripts/scan-imported-skills.d.ts.map +1 -1
- package/dist/src/scripts/scan-imported-skills.js +8 -397
- package/dist/src/scripts/scan-imported-skills.js.map +1 -1
- package/dist/src/scripts/skill-scanner/categorizer.d.ts +43 -0
- package/dist/src/scripts/skill-scanner/categorizer.d.ts.map +1 -0
- package/dist/src/scripts/skill-scanner/categorizer.js +61 -0
- package/dist/src/scripts/skill-scanner/categorizer.js.map +1 -0
- package/dist/src/scripts/skill-scanner/file-scanner.d.ts +43 -0
- package/dist/src/scripts/skill-scanner/file-scanner.d.ts.map +1 -0
- package/dist/src/scripts/skill-scanner/file-scanner.js +90 -0
- package/dist/src/scripts/skill-scanner/file-scanner.js.map +1 -0
- package/dist/src/scripts/skill-scanner/index.d.ts +22 -0
- package/dist/src/scripts/skill-scanner/index.d.ts.map +1 -0
- package/dist/src/scripts/skill-scanner/index.js +43 -0
- package/dist/src/scripts/skill-scanner/index.js.map +1 -0
- package/dist/src/scripts/skill-scanner/logger.d.ts +59 -0
- package/dist/src/scripts/skill-scanner/logger.d.ts.map +1 -0
- package/dist/src/scripts/skill-scanner/logger.js +104 -0
- package/dist/src/scripts/skill-scanner/logger.js.map +1 -0
- package/dist/src/scripts/skill-scanner/reporter.d.ts +56 -0
- package/dist/src/scripts/skill-scanner/reporter.d.ts.map +1 -0
- package/dist/src/scripts/skill-scanner/reporter.js +166 -0
- package/dist/src/scripts/skill-scanner/reporter.js.map +1 -0
- package/dist/src/scripts/skill-scanner/scanner.d.ts +44 -0
- package/dist/src/scripts/skill-scanner/scanner.d.ts.map +1 -0
- package/dist/src/scripts/skill-scanner/scanner.js +140 -0
- package/dist/src/scripts/skill-scanner/scanner.js.map +1 -0
- package/dist/src/scripts/skill-scanner/trust-scorer.d.ts +59 -0
- package/dist/src/scripts/skill-scanner/trust-scorer.d.ts.map +1 -0
- package/dist/src/scripts/skill-scanner/trust-scorer.js +62 -0
- package/dist/src/scripts/skill-scanner/trust-scorer.js.map +1 -0
- package/dist/src/scripts/skill-scanner/types.d.ts +98 -0
- package/dist/src/scripts/skill-scanner/types.d.ts.map +1 -0
- package/dist/src/scripts/skill-scanner/types.js +7 -0
- package/dist/src/scripts/skill-scanner/types.js.map +1 -0
- package/dist/src/scripts/validate-skills.d.ts +3 -172
- package/dist/src/scripts/validate-skills.d.ts.map +1 -1
- package/dist/src/scripts/validate-skills.js +6 -519
- package/dist/src/scripts/validate-skills.js.map +1 -1
- package/dist/src/scripts/validation/deduplication.d.ts +23 -0
- package/dist/src/scripts/validation/deduplication.d.ts.map +1 -0
- package/dist/src/scripts/validation/deduplication.js +127 -0
- package/dist/src/scripts/validation/deduplication.js.map +1 -0
- package/dist/src/scripts/validation/field-validators.d.ts +9 -0
- package/dist/src/scripts/validation/field-validators.d.ts.map +1 -0
- package/dist/src/scripts/validation/field-validators.js +135 -0
- package/dist/src/scripts/validation/field-validators.js.map +1 -0
- package/dist/src/scripts/validation/index.d.ts +29 -0
- package/dist/src/scripts/validation/index.d.ts.map +1 -0
- package/dist/src/scripts/validation/index.js +84 -0
- package/dist/src/scripts/validation/index.js.map +1 -0
- package/dist/src/scripts/validation/normalizers.d.ts +29 -0
- package/dist/src/scripts/validation/normalizers.d.ts.map +1 -0
- package/dist/src/scripts/validation/normalizers.js +79 -0
- package/dist/src/scripts/validation/normalizers.js.map +1 -0
- package/dist/src/scripts/validation/pipeline.d.ts +13 -0
- package/dist/src/scripts/validation/pipeline.d.ts.map +1 -0
- package/dist/src/scripts/validation/pipeline.js +126 -0
- package/dist/src/scripts/validation/pipeline.js.map +1 -0
- package/dist/src/scripts/validation/types.d.ts +128 -0
- package/dist/src/scripts/validation/types.d.ts.map +1 -0
- package/dist/src/scripts/validation/types.js +43 -0
- package/dist/src/scripts/validation/types.js.map +1 -0
- package/dist/src/security/index.d.ts +5 -4
- package/dist/src/security/index.d.ts.map +1 -1
- package/dist/src/security/index.js +8 -2
- package/dist/src/security/index.js.map +1 -1
- package/dist/src/security/rate-limiter/RateLimiter.d.ts +86 -0
- package/dist/src/security/rate-limiter/RateLimiter.d.ts.map +1 -0
- package/dist/src/security/rate-limiter/RateLimiter.js +260 -0
- package/dist/src/security/rate-limiter/RateLimiter.js.map +1 -0
- package/dist/src/security/rate-limiter/constants.d.ts +15 -0
- package/dist/src/security/rate-limiter/constants.d.ts.map +1 -0
- package/dist/src/security/rate-limiter/constants.js +15 -0
- package/dist/src/security/rate-limiter/constants.js.map +1 -0
- package/dist/src/security/rate-limiter/errors.d.ts +22 -0
- package/dist/src/security/rate-limiter/errors.d.ts.map +1 -0
- package/dist/src/security/rate-limiter/errors.js +32 -0
- package/dist/src/security/rate-limiter/errors.js.map +1 -0
- package/dist/src/security/rate-limiter/index.d.ts +12 -0
- package/dist/src/security/rate-limiter/index.d.ts.map +1 -0
- package/dist/src/security/rate-limiter/index.js +16 -0
- package/dist/src/security/rate-limiter/index.js.map +1 -0
- package/dist/src/security/rate-limiter/metrics-manager.d.ts +55 -0
- package/dist/src/security/rate-limiter/metrics-manager.d.ts.map +1 -0
- package/dist/src/security/rate-limiter/metrics-manager.js +144 -0
- package/dist/src/security/rate-limiter/metrics-manager.js.map +1 -0
- package/dist/src/security/rate-limiter/presets.d.ts +52 -0
- package/dist/src/security/rate-limiter/presets.d.ts.map +1 -0
- package/dist/src/security/rate-limiter/presets.js +53 -0
- package/dist/src/security/rate-limiter/presets.js.map +1 -0
- package/dist/src/security/rate-limiter/queue-manager.d.ts +59 -0
- package/dist/src/security/rate-limiter/queue-manager.d.ts.map +1 -0
- package/dist/src/security/rate-limiter/queue-manager.js +189 -0
- package/dist/src/security/rate-limiter/queue-manager.js.map +1 -0
- package/dist/src/security/rate-limiter/storage.d.ts +34 -0
- package/dist/src/security/rate-limiter/storage.d.ts.map +1 -0
- package/dist/src/security/rate-limiter/storage.js +80 -0
- package/dist/src/security/rate-limiter/storage.js.map +1 -0
- package/dist/src/security/rate-limiter/token-bucket.d.ts +44 -0
- package/dist/src/security/rate-limiter/token-bucket.d.ts.map +1 -0
- package/dist/src/security/rate-limiter/token-bucket.js +99 -0
- package/dist/src/security/rate-limiter/token-bucket.js.map +1 -0
- package/dist/src/security/rate-limiter/types.d.ts +104 -0
- package/dist/src/security/rate-limiter/types.d.ts.map +1 -0
- package/dist/src/security/rate-limiter/types.js +7 -0
- package/dist/src/security/rate-limiter/types.js.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.d.ts +94 -0
- package/dist/src/security/scanner/SecurityScanner.d.ts.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.js +403 -0
- package/dist/src/security/scanner/SecurityScanner.js.map +1 -0
- package/dist/src/security/scanner/index.d.ts +11 -0
- package/dist/src/security/scanner/index.d.ts.map +1 -0
- package/dist/src/security/scanner/index.js +14 -0
- package/dist/src/security/scanner/index.js.map +1 -0
- package/dist/src/security/scanner/patterns.d.ts +14 -0
- package/dist/src/security/scanner/patterns.d.ts.map +1 -0
- package/dist/src/security/scanner/patterns.js +147 -0
- package/dist/src/security/scanner/patterns.js.map +1 -0
- package/dist/src/security/scanner/regex-utils.d.ts +33 -0
- package/dist/src/security/scanner/regex-utils.d.ts.map +1 -0
- package/dist/src/security/scanner/regex-utils.js +41 -0
- package/dist/src/security/scanner/regex-utils.js.map +1 -0
- package/dist/src/security/scanner/types.d.ts +63 -0
- package/dist/src/security/scanner/types.d.ts.map +1 -0
- package/dist/src/security/scanner/types.js +7 -0
- package/dist/src/security/scanner/types.js.map +1 -0
- package/dist/src/security/scanner/weights.d.ts +15 -0
- package/dist/src/security/scanner/weights.d.ts.map +1 -0
- package/dist/src/security/scanner/weights.js +28 -0
- package/dist/src/security/scanner/weights.js.map +1 -0
- package/dist/src/session/SessionHealthMonitor.d.ts +5 -168
- package/dist/src/session/SessionHealthMonitor.d.ts.map +1 -1
- package/dist/src/session/SessionHealthMonitor.js +22 -91
- package/dist/src/session/SessionHealthMonitor.js.map +1 -1
- package/dist/src/session/health-checks.d.ts +37 -0
- package/dist/src/session/health-checks.d.ts.map +1 -0
- package/dist/src/session/health-checks.js +64 -0
- package/dist/src/session/health-checks.js.map +1 -0
- package/dist/src/session/health-types.d.ts +78 -0
- package/dist/src/session/health-types.d.ts.map +1 -0
- package/dist/src/session/health-types.js +16 -0
- package/dist/src/session/health-types.js.map +1 -0
- package/dist/src/session/index.d.ts +5 -1
- package/dist/src/session/index.d.ts.map +1 -1
- package/dist/src/session/index.js +9 -0
- package/dist/src/session/index.js.map +1 -1
- package/dist/src/session/metrics-collector.d.ts +23 -0
- package/dist/src/session/metrics-collector.d.ts.map +1 -0
- package/dist/src/session/metrics-collector.js +44 -0
- package/dist/src/session/metrics-collector.js.map +1 -0
- package/dist/src/session/typed-event-emitter.d.ts +70 -0
- package/dist/src/session/typed-event-emitter.d.ts.map +1 -0
- package/dist/src/session/typed-event-emitter.js +79 -0
- package/dist/src/session/typed-event-emitter.js.map +1 -0
- package/dist/src/sources/BaseSourceAdapter.d.ts +1 -1
- package/dist/src/sources/BaseSourceAdapter.d.ts.map +1 -1
- package/dist/src/sources/BaseSourceAdapter.js +2 -2
- package/dist/src/sources/BaseSourceAdapter.js.map +1 -1
- package/dist/src/telemetry/index.d.ts +1 -0
- package/dist/src/telemetry/index.d.ts.map +1 -1
- package/dist/src/telemetry/index.js +2 -0
- package/dist/src/telemetry/index.js.map +1 -1
- package/dist/src/telemetry/posthog.d.ts +125 -0
- package/dist/src/telemetry/posthog.d.ts.map +1 -0
- package/dist/src/telemetry/posthog.js +198 -0
- package/dist/src/telemetry/posthog.js.map +1 -0
- package/dist/tests/RateLimiter.test.js +4 -4
- package/dist/tests/RateLimiter.test.js.map +1 -1
- package/dist/tests/e2e/security/security.e2e.test.js +3 -3
- package/dist/tests/e2e/security/security.e2e.test.js.map +1 -1
- package/package.json +2 -1
|
@@ -1,404 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* SMI-689: MemoryProfiler
|
|
2
|
+
* SMI-689: MemoryProfiler
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* - Detect memory leaks over threshold
|
|
7
|
-
* - Get heap snapshots using V8 statistics
|
|
8
|
-
* - Generate human-readable memory reports
|
|
9
|
-
* - Baseline comparison for memory regression detection
|
|
4
|
+
* Re-exports from memory module for backward compatibility.
|
|
5
|
+
* See memory/ subdirectory for implementation.
|
|
10
6
|
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* MemoryProfiler provides comprehensive memory tracking and leak detection
|
|
14
|
-
* for the benchmark infrastructure.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* const profiler = new MemoryProfiler();
|
|
19
|
-
*
|
|
20
|
-
* profiler.trackMemory('heavy_operation');
|
|
21
|
-
* await heavyOperation();
|
|
22
|
-
* const stats = profiler.stopTracking('heavy_operation');
|
|
23
|
-
*
|
|
24
|
-
* console.log(`Heap grew by ${stats.heapGrowthPercent}%`);
|
|
25
|
-
*
|
|
26
|
-
* // Check for leaks
|
|
27
|
-
* const leakResult = profiler.detectLeaks(10);
|
|
28
|
-
* if (leakResult.hasLeaks) {
|
|
29
|
-
* console.error(leakResult.message);
|
|
30
|
-
* }
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export class MemoryProfiler {
|
|
34
|
-
activeTracking = new Map();
|
|
35
|
-
completedStats = new Map();
|
|
36
|
-
baselines = new Map();
|
|
37
|
-
samplingIntervalMs;
|
|
38
|
-
/**
|
|
39
|
-
* Create a new MemoryProfiler instance
|
|
40
|
-
*
|
|
41
|
-
* @param samplingIntervalMs - Interval in ms for collecting memory samples (default: 100ms)
|
|
42
|
-
*/
|
|
43
|
-
constructor(samplingIntervalMs = 100) {
|
|
44
|
-
this.samplingIntervalMs = samplingIntervalMs;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Start tracking memory for a labeled operation
|
|
48
|
-
*
|
|
49
|
-
* @param label - Unique label to identify this tracking session
|
|
50
|
-
* @throws Error if label is already being tracked
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```typescript
|
|
54
|
-
* profiler.trackMemory('database_query');
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
|
-
trackMemory(label) {
|
|
58
|
-
if (this.activeTracking.has(label)) {
|
|
59
|
-
throw new Error(`Memory tracking already active for label: ${label}`);
|
|
60
|
-
}
|
|
61
|
-
// Force GC if available for more accurate starting point
|
|
62
|
-
this.forceGC();
|
|
63
|
-
const startSnapshot = this.getHeapSnapshot();
|
|
64
|
-
const entry = {
|
|
65
|
-
label,
|
|
66
|
-
startSnapshot,
|
|
67
|
-
startTime: performance.now(),
|
|
68
|
-
samples: [startSnapshot],
|
|
69
|
-
};
|
|
70
|
-
// Start periodic sampling
|
|
71
|
-
entry.samplingInterval = setInterval(() => {
|
|
72
|
-
const snapshot = this.getHeapSnapshot();
|
|
73
|
-
entry.samples.push(snapshot);
|
|
74
|
-
}, this.samplingIntervalMs);
|
|
75
|
-
this.activeTracking.set(label, entry);
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Stop tracking memory for a labeled operation and return statistics
|
|
79
|
-
*
|
|
80
|
-
* @param label - Label of the tracking session to stop
|
|
81
|
-
* @returns Memory statistics for the tracked operation
|
|
82
|
-
* @throws Error if label is not being tracked
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* ```typescript
|
|
86
|
-
* const stats = profiler.stopTracking('database_query');
|
|
87
|
-
* console.log(`Heap growth: ${stats.heapGrowthPercent}%`);
|
|
88
|
-
* ```
|
|
89
|
-
*/
|
|
90
|
-
stopTracking(label) {
|
|
91
|
-
const entry = this.activeTracking.get(label);
|
|
92
|
-
if (!entry) {
|
|
93
|
-
throw new Error(`No active memory tracking for label: ${label}`);
|
|
94
|
-
}
|
|
95
|
-
// Stop sampling
|
|
96
|
-
if (entry.samplingInterval) {
|
|
97
|
-
clearInterval(entry.samplingInterval);
|
|
98
|
-
}
|
|
99
|
-
// Force GC for accurate end measurement
|
|
100
|
-
this.forceGC();
|
|
101
|
-
const endSnapshot = this.getHeapSnapshot();
|
|
102
|
-
const duration = performance.now() - entry.startTime;
|
|
103
|
-
// Calculate peak from samples
|
|
104
|
-
const peakHeapUsed = Math.max(entry.startSnapshot.usedHeapSize, ...entry.samples.map((s) => s.usedHeapSize), endSnapshot.usedHeapSize);
|
|
105
|
-
const heapGrowth = endSnapshot.usedHeapSize - entry.startSnapshot.usedHeapSize;
|
|
106
|
-
const heapGrowthPercent = entry.startSnapshot.usedHeapSize > 0
|
|
107
|
-
? (heapGrowth / entry.startSnapshot.usedHeapSize) * 100
|
|
108
|
-
: 0;
|
|
109
|
-
const stats = {
|
|
110
|
-
label,
|
|
111
|
-
startSnapshot: entry.startSnapshot,
|
|
112
|
-
endSnapshot,
|
|
113
|
-
duration,
|
|
114
|
-
heapGrowth,
|
|
115
|
-
heapGrowthPercent: Math.round(heapGrowthPercent * 100) / 100,
|
|
116
|
-
peakHeapUsed,
|
|
117
|
-
sampleCount: entry.samples.length + 1,
|
|
118
|
-
};
|
|
119
|
-
this.completedStats.set(label, stats);
|
|
120
|
-
this.activeTracking.delete(label);
|
|
121
|
-
return stats;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Get current heap statistics using V8
|
|
125
|
-
*
|
|
126
|
-
* @returns Current memory snapshot
|
|
127
|
-
*
|
|
128
|
-
* @example
|
|
129
|
-
* ```typescript
|
|
130
|
-
* const snapshot = profiler.getHeapSnapshot();
|
|
131
|
-
* console.log(`Used heap: ${snapshot.usedHeapSize / 1024 / 1024} MB`);
|
|
132
|
-
* ```
|
|
133
|
-
*/
|
|
134
|
-
getHeapSnapshot() {
|
|
135
|
-
const heapStats = v8.getHeapStatistics();
|
|
136
|
-
const memUsage = process.memoryUsage();
|
|
137
|
-
return {
|
|
138
|
-
timestamp: Date.now(),
|
|
139
|
-
totalHeapSize: heapStats.total_heap_size,
|
|
140
|
-
usedHeapSize: heapStats.used_heap_size,
|
|
141
|
-
externalMemory: memUsage.external,
|
|
142
|
-
heapSizeLimit: heapStats.heap_size_limit,
|
|
143
|
-
totalPhysicalSize: heapStats.total_physical_size,
|
|
144
|
-
totalAvailableSize: heapStats.total_available_size,
|
|
145
|
-
mallocedMemory: heapStats.malloced_memory,
|
|
146
|
-
peakMallocedMemory: heapStats.peak_malloced_memory,
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Detect potential memory leaks across all completed tracking sessions
|
|
151
|
-
*
|
|
152
|
-
* @param threshold - Heap growth percentage threshold to consider a leak (default: 10%)
|
|
153
|
-
* @returns Leak detection result
|
|
154
|
-
*
|
|
155
|
-
* @example
|
|
156
|
-
* ```typescript
|
|
157
|
-
* const result = profiler.detectLeaks(15); // 15% threshold
|
|
158
|
-
* if (result.hasLeaks) {
|
|
159
|
-
* console.error(`Potential leak detected: ${result.message}`);
|
|
160
|
-
* }
|
|
161
|
-
* ```
|
|
162
|
-
*/
|
|
163
|
-
detectLeaks(threshold = 10) {
|
|
164
|
-
const suspectedLabels = [];
|
|
165
|
-
let totalLeakedBytes = 0;
|
|
166
|
-
let maxGrowthPercent = 0;
|
|
167
|
-
for (const [label, stats] of this.completedStats) {
|
|
168
|
-
if (stats.heapGrowthPercent > threshold) {
|
|
169
|
-
suspectedLabels.push(label);
|
|
170
|
-
totalLeakedBytes += stats.heapGrowth;
|
|
171
|
-
maxGrowthPercent = Math.max(maxGrowthPercent, stats.heapGrowthPercent);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
const hasLeaks = suspectedLabels.length > 0;
|
|
175
|
-
return {
|
|
176
|
-
hasLeaks,
|
|
177
|
-
threshold,
|
|
178
|
-
heapGrowthPercent: Math.round(maxGrowthPercent * 100) / 100,
|
|
179
|
-
leakedBytes: totalLeakedBytes,
|
|
180
|
-
suspectedLabels,
|
|
181
|
-
message: hasLeaks
|
|
182
|
-
? `Potential memory leak detected in ${suspectedLabels.length} operation(s): ${suspectedLabels.join(', ')}. ` +
|
|
183
|
-
`Total leaked: ${this.formatBytes(totalLeakedBytes)}, max growth: ${maxGrowthPercent.toFixed(2)}%`
|
|
184
|
-
: `No memory leaks detected (threshold: ${threshold}%)`,
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Save a baseline for memory regression comparison
|
|
189
|
-
*
|
|
190
|
-
* @param label - Label to save as baseline
|
|
191
|
-
* @throws Error if no completed stats exist for the label
|
|
192
|
-
*/
|
|
193
|
-
saveBaseline(label) {
|
|
194
|
-
const stats = this.completedStats.get(label);
|
|
195
|
-
if (!stats) {
|
|
196
|
-
throw new Error(`No completed stats for label: ${label}`);
|
|
197
|
-
}
|
|
198
|
-
const baseline = {
|
|
199
|
-
label,
|
|
200
|
-
timestamp: new Date().toISOString(),
|
|
201
|
-
avgHeapUsed: stats.startSnapshot.usedHeapSize +
|
|
202
|
-
(stats.endSnapshot?.usedHeapSize ?? stats.startSnapshot.usedHeapSize),
|
|
203
|
-
peakHeapUsed: stats.peakHeapUsed,
|
|
204
|
-
sampleCount: stats.sampleCount,
|
|
205
|
-
};
|
|
206
|
-
baseline.avgHeapUsed = baseline.avgHeapUsed / 2;
|
|
207
|
-
this.baselines.set(label, baseline);
|
|
208
|
-
return baseline;
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Load baselines from a JSON object
|
|
212
|
-
*
|
|
213
|
-
* @param baselines - Object mapping labels to baselines
|
|
214
|
-
*/
|
|
215
|
-
loadBaselines(baselines) {
|
|
216
|
-
for (const [label, baseline] of Object.entries(baselines)) {
|
|
217
|
-
this.baselines.set(label, baseline);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Check for memory regression against baseline
|
|
222
|
-
*
|
|
223
|
-
* @param label - Label to check
|
|
224
|
-
* @param threshold - Regression threshold percentage (default: 10%)
|
|
225
|
-
* @returns Regression result
|
|
226
|
-
*/
|
|
227
|
-
checkRegression(label, threshold = 10) {
|
|
228
|
-
const baseline = this.baselines.get(label);
|
|
229
|
-
const current = this.completedStats.get(label);
|
|
230
|
-
if (!baseline) {
|
|
231
|
-
return {
|
|
232
|
-
hasRegression: false,
|
|
233
|
-
threshold,
|
|
234
|
-
label,
|
|
235
|
-
baselineHeap: 0,
|
|
236
|
-
currentHeap: current?.peakHeapUsed ?? 0,
|
|
237
|
-
changePercent: 0,
|
|
238
|
-
message: `No baseline exists for label: ${label}`,
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
if (!current) {
|
|
242
|
-
return {
|
|
243
|
-
hasRegression: false,
|
|
244
|
-
threshold,
|
|
245
|
-
label,
|
|
246
|
-
baselineHeap: baseline.peakHeapUsed,
|
|
247
|
-
currentHeap: 0,
|
|
248
|
-
changePercent: 0,
|
|
249
|
-
message: `No current stats exist for label: ${label}`,
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
const changePercent = baseline.peakHeapUsed > 0
|
|
253
|
-
? ((current.peakHeapUsed - baseline.peakHeapUsed) / baseline.peakHeapUsed) * 100
|
|
254
|
-
: 0;
|
|
255
|
-
const hasRegression = changePercent > threshold;
|
|
256
|
-
return {
|
|
257
|
-
hasRegression,
|
|
258
|
-
threshold,
|
|
259
|
-
label,
|
|
260
|
-
baselineHeap: baseline.peakHeapUsed,
|
|
261
|
-
currentHeap: current.peakHeapUsed,
|
|
262
|
-
changePercent: Math.round(changePercent * 100) / 100,
|
|
263
|
-
message: hasRegression
|
|
264
|
-
? `Memory regression detected for ${label}: heap grew by ${changePercent.toFixed(2)}% ` +
|
|
265
|
-
`(${this.formatBytes(baseline.peakHeapUsed)} -> ${this.formatBytes(current.peakHeapUsed)})`
|
|
266
|
-
: `No memory regression for ${label} (change: ${changePercent.toFixed(2)}%)`,
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* Generate a human-readable memory report
|
|
271
|
-
*
|
|
272
|
-
* @returns Formatted memory report string
|
|
273
|
-
*
|
|
274
|
-
* @example
|
|
275
|
-
* ```typescript
|
|
276
|
-
* profiler.trackMemory('op1');
|
|
277
|
-
* await operation1();
|
|
278
|
-
* profiler.stopTracking('op1');
|
|
279
|
-
*
|
|
280
|
-
* console.log(profiler.formatMemoryReport());
|
|
281
|
-
* ```
|
|
282
|
-
*/
|
|
283
|
-
formatMemoryReport() {
|
|
284
|
-
const lines = [
|
|
285
|
-
'╔══════════════════════════════════════════════════════════════════════════════╗',
|
|
286
|
-
'║ SMI-689: Memory Profiling Report ║',
|
|
287
|
-
'╠══════════════════════════════════════════════════════════════════════════════╣',
|
|
288
|
-
];
|
|
289
|
-
// Current heap snapshot
|
|
290
|
-
const current = this.getHeapSnapshot();
|
|
291
|
-
lines.push('║ Current Heap Status: ║');
|
|
292
|
-
lines.push(`║ Used Heap: ${this.formatBytes(current.usedHeapSize).padEnd(15)} │ Total Heap: ${this.formatBytes(current.totalHeapSize).padEnd(15)} ║`);
|
|
293
|
-
lines.push(`║ Heap Limit: ${this.formatBytes(current.heapSizeLimit).padEnd(15)} │ External: ${this.formatBytes(current.externalMemory).padEnd(15)} ║`);
|
|
294
|
-
lines.push('║ ║');
|
|
295
|
-
// Completed tracking stats
|
|
296
|
-
if (this.completedStats.size > 0) {
|
|
297
|
-
lines.push('║ Tracked Operations: ║');
|
|
298
|
-
lines.push('║ ─────────────────────────────────────────────────────────────────────────────║');
|
|
299
|
-
for (const [label, stats] of this.completedStats) {
|
|
300
|
-
const growthColor = stats.heapGrowthPercent > 10 ? '!' : stats.heapGrowthPercent > 5 ? '~' : ' ';
|
|
301
|
-
lines.push(`║ ${growthColor} ${label.substring(0, 25).padEnd(25)} │ Duration: ${stats.duration.toFixed(0).padStart(6)}ms │ Growth: ${stats.heapGrowthPercent.toFixed(1).padStart(6)}% ║`);
|
|
302
|
-
lines.push(`║ Start: ${this.formatBytes(stats.startSnapshot.usedHeapSize).padEnd(10)} │ End: ${this.formatBytes(stats.endSnapshot?.usedHeapSize ?? 0).padEnd(10)} │ Peak: ${this.formatBytes(stats.peakHeapUsed).padEnd(10)} ║`);
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
else {
|
|
306
|
-
lines.push('║ No tracked operations recorded. ║');
|
|
307
|
-
}
|
|
308
|
-
// Active tracking
|
|
309
|
-
if (this.activeTracking.size > 0) {
|
|
310
|
-
lines.push('║ ║');
|
|
311
|
-
lines.push('║ Active Tracking: ║');
|
|
312
|
-
for (const [label, entry] of this.activeTracking) {
|
|
313
|
-
const elapsed = (performance.now() - entry.startTime).toFixed(0);
|
|
314
|
-
lines.push(`║ ${label.substring(0, 30).padEnd(30)} │ Elapsed: ${elapsed.padStart(6)}ms │ Samples: ${String(entry.samples.length).padStart(4)} ║`);
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
// Leak detection summary
|
|
318
|
-
const leakResult = this.detectLeaks(10);
|
|
319
|
-
lines.push('║ ║');
|
|
320
|
-
lines.push('║ Leak Detection (10% threshold): ║');
|
|
321
|
-
if (leakResult.hasLeaks) {
|
|
322
|
-
lines.push(`║ ⚠ POTENTIAL LEAKS DETECTED ║`);
|
|
323
|
-
lines.push(`║ Suspected: ${leakResult.suspectedLabels.slice(0, 3).join(', ').substring(0, 60).padEnd(60)} ║`);
|
|
324
|
-
lines.push(`║ Total leaked: ${this.formatBytes(leakResult.leakedBytes).padEnd(15)} │ Max growth: ${leakResult.heapGrowthPercent.toFixed(1).padStart(6)}% ║`);
|
|
325
|
-
}
|
|
326
|
-
else {
|
|
327
|
-
lines.push(`║ ✓ No memory leaks detected ║`);
|
|
328
|
-
}
|
|
329
|
-
lines.push('╚══════════════════════════════════════════════════════════════════════════════╝');
|
|
330
|
-
return lines.join('\n');
|
|
331
|
-
}
|
|
332
|
-
/**
|
|
333
|
-
* Get all completed statistics
|
|
334
|
-
*
|
|
335
|
-
* @returns Map of label to MemoryStats
|
|
336
|
-
*/
|
|
337
|
-
getCompletedStats() {
|
|
338
|
-
return new Map(this.completedStats);
|
|
339
|
-
}
|
|
340
|
-
/**
|
|
341
|
-
* Get all baselines
|
|
342
|
-
*
|
|
343
|
-
* @returns Map of label to MemoryBaseline
|
|
344
|
-
*/
|
|
345
|
-
getBaselines() {
|
|
346
|
-
return new Map(this.baselines);
|
|
347
|
-
}
|
|
348
|
-
/**
|
|
349
|
-
* Export baselines as JSON-serializable object
|
|
350
|
-
*
|
|
351
|
-
* @returns Object mapping labels to baselines
|
|
352
|
-
*/
|
|
353
|
-
exportBaselines() {
|
|
354
|
-
const result = {};
|
|
355
|
-
for (const [label, baseline] of this.baselines) {
|
|
356
|
-
result[label] = baseline;
|
|
357
|
-
}
|
|
358
|
-
return result;
|
|
359
|
-
}
|
|
360
|
-
/**
|
|
361
|
-
* Clear all tracking data
|
|
362
|
-
*/
|
|
363
|
-
clear() {
|
|
364
|
-
// Stop any active tracking
|
|
365
|
-
for (const entry of this.activeTracking.values()) {
|
|
366
|
-
if (entry.samplingInterval) {
|
|
367
|
-
clearInterval(entry.samplingInterval);
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
this.activeTracking.clear();
|
|
371
|
-
this.completedStats.clear();
|
|
372
|
-
}
|
|
373
|
-
/**
|
|
374
|
-
* Clear baselines
|
|
375
|
-
*/
|
|
376
|
-
clearBaselines() {
|
|
377
|
-
this.baselines.clear();
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
* Force garbage collection if available
|
|
381
|
-
*/
|
|
382
|
-
forceGC() {
|
|
383
|
-
if (typeof global.gc === 'function') {
|
|
384
|
-
global.gc();
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* Format bytes to human-readable string
|
|
389
|
-
*/
|
|
390
|
-
formatBytes(bytes) {
|
|
391
|
-
if (bytes === 0)
|
|
392
|
-
return '0 B';
|
|
393
|
-
const k = 1024;
|
|
394
|
-
const sizes = ['B', 'KB', 'MB', 'GB'];
|
|
395
|
-
const i = Math.floor(Math.log(Math.abs(bytes)) / Math.log(k));
|
|
396
|
-
const value = bytes / Math.pow(k, i);
|
|
397
|
-
return `${value.toFixed(1)} ${sizes[i]}`;
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* Default memory profiler instance for convenience
|
|
402
|
-
*/
|
|
403
|
-
export const defaultMemoryProfiler = new MemoryProfiler();
|
|
7
|
+
export * from './memory/index.js';
|
|
404
8
|
//# sourceMappingURL=MemoryProfiler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryProfiler.js","sourceRoot":"","sources":["../../../src/benchmarks/MemoryProfiler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AAiHxB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,cAAc;IACjB,cAAc,GAA+B,IAAI,GAAG,EAAE,CAAA;IACtD,cAAc,GAA6B,IAAI,GAAG,EAAE,CAAA;IACpD,SAAS,GAAgC,IAAI,GAAG,EAAE,CAAA;IAClD,kBAAkB,CAAQ;IAElC;;;;OAIG;IACH,YAAY,qBAA6B,GAAG;QAC1C,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAA;IAC9C,CAAC;IAED;;;;;;;;;;OAUG;IAC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,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;QAC7D,MAAM,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QACpC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;IAC1C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,cAAc,EAAE,CAAA"}
|
|
1
|
+
{"version":3,"file":"MemoryProfiler.js","sourceRoot":"","sources":["../../../src/benchmarks/MemoryProfiler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMI-632: Benchmark Report Comparison
|
|
3
|
+
* SMI-1189: Extracted from BenchmarkRunner.ts
|
|
4
|
+
*
|
|
5
|
+
* Functions for comparing benchmark reports to detect
|
|
6
|
+
* performance regressions and improvements.
|
|
7
|
+
*/
|
|
8
|
+
import type { BenchmarkReport, ComparisonResult, MetricComparison } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Compare two benchmark reports to detect regressions/improvements
|
|
11
|
+
*
|
|
12
|
+
* @param baseline - Baseline report to compare against
|
|
13
|
+
* @param current - Current report to compare
|
|
14
|
+
* @returns Comparison result with regression/improvement details
|
|
15
|
+
*/
|
|
16
|
+
export declare function compareReports(baseline: BenchmarkReport, current: BenchmarkReport): ComparisonResult;
|
|
17
|
+
/**
|
|
18
|
+
* Check if a comparison has any regressions
|
|
19
|
+
*
|
|
20
|
+
* @param comparison - Comparison result to check
|
|
21
|
+
* @returns True if any regressions were detected
|
|
22
|
+
*/
|
|
23
|
+
export declare function hasRegressions(comparison: ComparisonResult): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Get only the regressed benchmarks from a comparison
|
|
26
|
+
*
|
|
27
|
+
* @param comparison - Comparison result to filter
|
|
28
|
+
* @returns Array of [name, comparison] pairs for regressed benchmarks
|
|
29
|
+
*/
|
|
30
|
+
export declare function getRegressedBenchmarks(comparison: ComparisonResult): Array<[string, MetricComparison]>;
|
|
31
|
+
/**
|
|
32
|
+
* Get only the improved benchmarks from a comparison
|
|
33
|
+
*
|
|
34
|
+
* @param comparison - Comparison result to filter
|
|
35
|
+
* @returns Array of [name, comparison] pairs for improved benchmarks
|
|
36
|
+
*/
|
|
37
|
+
export declare function getImprovedBenchmarks(comparison: ComparisonResult): Array<[string, MetricComparison]>;
|
|
38
|
+
//# sourceMappingURL=comparator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comparator.d.ts","sourceRoot":"","sources":["../../../src/benchmarks/comparator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAErF;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,eAAe,GACvB,gBAAgB,CAyClB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,gBAAgB,GAAG,OAAO,CAEpE;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,gBAAgB,GAC3B,KAAK,CAAC,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAEnC;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,gBAAgB,GAC3B,KAAK,CAAC,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAEnC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMI-632: Benchmark Report Comparison
|
|
3
|
+
* SMI-1189: Extracted from BenchmarkRunner.ts
|
|
4
|
+
*
|
|
5
|
+
* Functions for comparing benchmark reports to detect
|
|
6
|
+
* performance regressions and improvements.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Compare two benchmark reports to detect regressions/improvements
|
|
10
|
+
*
|
|
11
|
+
* @param baseline - Baseline report to compare against
|
|
12
|
+
* @param current - Current report to compare
|
|
13
|
+
* @returns Comparison result with regression/improvement details
|
|
14
|
+
*/
|
|
15
|
+
export function compareReports(baseline, current) {
|
|
16
|
+
const comparisons = {};
|
|
17
|
+
let regressions = 0;
|
|
18
|
+
let improvements = 0;
|
|
19
|
+
for (const [name, currentStats] of Object.entries(current.results)) {
|
|
20
|
+
const baselineStats = baseline.results[name];
|
|
21
|
+
if (!baselineStats)
|
|
22
|
+
continue;
|
|
23
|
+
const p50Change = ((currentStats.p50_ms - baselineStats.p50_ms) / baselineStats.p50_ms) * 100;
|
|
24
|
+
const p95Change = ((currentStats.p95_ms - baselineStats.p95_ms) / baselineStats.p95_ms) * 100;
|
|
25
|
+
const p99Change = ((currentStats.p99_ms - baselineStats.p99_ms) / baselineStats.p99_ms) * 100;
|
|
26
|
+
const isRegression = p95Change > 10; // 10% threshold
|
|
27
|
+
const isImprovement = p95Change < -10;
|
|
28
|
+
if (isRegression)
|
|
29
|
+
regressions++;
|
|
30
|
+
if (isImprovement)
|
|
31
|
+
improvements++;
|
|
32
|
+
comparisons[name] = {
|
|
33
|
+
baseline: baselineStats,
|
|
34
|
+
current: currentStats,
|
|
35
|
+
p50ChangePercent: Math.round(p50Change * 100) / 100,
|
|
36
|
+
p95ChangePercent: Math.round(p95Change * 100) / 100,
|
|
37
|
+
p99ChangePercent: Math.round(p99Change * 100) / 100,
|
|
38
|
+
isRegression,
|
|
39
|
+
isImprovement,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
baseline: baseline.timestamp,
|
|
44
|
+
current: current.timestamp,
|
|
45
|
+
comparisons,
|
|
46
|
+
summary: {
|
|
47
|
+
totalComparisons: Object.keys(comparisons).length,
|
|
48
|
+
regressions,
|
|
49
|
+
improvements,
|
|
50
|
+
unchanged: Object.keys(comparisons).length - regressions - improvements,
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Check if a comparison has any regressions
|
|
56
|
+
*
|
|
57
|
+
* @param comparison - Comparison result to check
|
|
58
|
+
* @returns True if any regressions were detected
|
|
59
|
+
*/
|
|
60
|
+
export function hasRegressions(comparison) {
|
|
61
|
+
return comparison.summary.regressions > 0;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get only the regressed benchmarks from a comparison
|
|
65
|
+
*
|
|
66
|
+
* @param comparison - Comparison result to filter
|
|
67
|
+
* @returns Array of [name, comparison] pairs for regressed benchmarks
|
|
68
|
+
*/
|
|
69
|
+
export function getRegressedBenchmarks(comparison) {
|
|
70
|
+
return Object.entries(comparison.comparisons).filter(([, comp]) => comp.isRegression);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Get only the improved benchmarks from a comparison
|
|
74
|
+
*
|
|
75
|
+
* @param comparison - Comparison result to filter
|
|
76
|
+
* @returns Array of [name, comparison] pairs for improved benchmarks
|
|
77
|
+
*/
|
|
78
|
+
export function getImprovedBenchmarks(comparison) {
|
|
79
|
+
return Object.entries(comparison.comparisons).filter(([, comp]) => comp.isImprovement);
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=comparator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comparator.js","sourceRoot":"","sources":["../../../src/benchmarks/comparator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,QAAyB,EACzB,OAAwB;IAExB,MAAM,WAAW,GAAqC,EAAE,CAAA;IACxD,IAAI,WAAW,GAAG,CAAC,CAAA;IACnB,IAAI,YAAY,GAAG,CAAC,CAAA;IAEpB,KAAK,MAAM,CAAC,IAAI,EAAE,YAAY,CAA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SAAS;QAC1B,WAAW;QACX,OAAO,EAAE;YACP,gBAAgB,EAAE,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM;YACjD,WAAW;YACX,YAAY;YACZ,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,GAAG,WAAW,GAAG,YAAY;SACxE;KACF,CAAA;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,UAA4B;IACzD,OAAO,UAAU,CAAC,OAAO,CAAC,WAAW,GAAG,CAAC,CAAA;AAC3C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CACpC,UAA4B;IAE5B,OAAO,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;AACvF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CACnC,UAA4B;IAE5B,OAAO,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;AACxF,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMI-632: Benchmark Report Formatters
|
|
3
|
+
* SMI-689: Enhanced with memory profiling output
|
|
4
|
+
* SMI-1189: Extracted from BenchmarkRunner.ts
|
|
5
|
+
*
|
|
6
|
+
* Functions for formatting benchmark reports in various output formats.
|
|
7
|
+
*/
|
|
8
|
+
import type { BenchmarkReport } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Format bytes to human-readable string
|
|
11
|
+
*
|
|
12
|
+
* @param bytes - Number of bytes
|
|
13
|
+
* @returns Human-readable string (e.g., "1.5 MB")
|
|
14
|
+
*/
|
|
15
|
+
export declare function formatBytes(bytes: number): string;
|
|
16
|
+
/**
|
|
17
|
+
* Format a benchmark report as JSON for CI integration
|
|
18
|
+
*
|
|
19
|
+
* @param report - Benchmark report to format
|
|
20
|
+
* @returns JSON string
|
|
21
|
+
*/
|
|
22
|
+
export declare function formatReportAsJson(report: BenchmarkReport): string;
|
|
23
|
+
/**
|
|
24
|
+
* Format a benchmark report as human-readable text
|
|
25
|
+
*
|
|
26
|
+
* @param report - Benchmark report to format
|
|
27
|
+
* @returns Formatted text string
|
|
28
|
+
*/
|
|
29
|
+
export declare function formatReportAsText(report: BenchmarkReport): string;
|
|
30
|
+
//# sourceMappingURL=formatters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../../src/benchmarks/formatters.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAOjD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAElE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CA0DlE"}
|