Check build output sizes

May 24, 2026 ยท View on GitHub

Hack23 Logo

โšก Black Trigram (ํ‘๊ด˜) โ€” Performance Testing & Benchmarks

Comprehensive Performance Validation & Monitoring Framework
๐Ÿš€ Lighthouse Audits โ€ข ๐Ÿ“Š Performance Budgets โ€ข ๐ŸŽฎ 60fps Combat Rendering

Test & Report OpenSSF Scorecard Quality Gate Status

๐Ÿ” ISMS Alignment: This document follows Hack23 Secure Development Policy performance testing and monitoring requirements.

๐Ÿ“‹ Document Owner: CEO | ๐Ÿ“… Last Updated: February 2026
๐Ÿ”„ Review Cycle: Quarterly | โฐ Next Review: May 2026


๐ŸŽฏ Purpose & Scope

This document establishes the comprehensive performance testing strategy, benchmarks, and optimization practices for the Black Trigram Korean martial arts combat simulator, ensuring optimal gameplay experience and rendering performance aligned with Hack23 ISMS Secure Development Policy ยง8.

Performance validation ensures:

  • โœ… Smooth 60fps combat rendering on desktop (55fps+ mobile)
  • โœ… Optimal bundle sizes within performance budgets (<500KB initial, <2MB total)
  • โœ… Lighthouse scores meeting quality standards (90+ performance)
  • โœ… Continuous performance monitoring and regression prevention
  • โœ… Three.js scene optimization (instancing, LOD, culling)
  • โœ… ISO/IEC 27001:2022 (A.8.6) compliance for capacity management
  • โœ… NIST CSF (ID.AM-1) compliance for asset performance characteristics

DocumentDescription
๐Ÿ“ ARCHITECTURE.mdHigh-level C4 architecture and component views
โš”๏ธ COMBAT_ARCHITECTURE.mdCombat system performance requirements
๐Ÿงช UnitTestPlan.mdUnit testing strategy with coverage targets
๐ŸŽฏ E2ETestPlan.mdEnd-to-end testing including performance scenarios
๐Ÿ”ง WORKFLOWS.mdCI/CD pipeline with performance gates
๐Ÿ›ก๏ธ SECURITY_ARCHITECTURE.mdSecurity architecture and performance implications
๐Ÿ“Š game-status.mdCurrent performance metrics and quality scores

๐Ÿ“Š Performance Standards & Current Metrics

๐ŸŽฏ Lighthouse Audit Targets

MetricTarget ScoreStatusDescription
Performance90+๐ŸŽฏ TargetCore Web Vitals and rendering speed
Accessibility95+๐ŸŽฏ TargetARIA labels, contrast, keyboard navigation
Best Practices95+๐ŸŽฏ TargetSecurity headers, HTTPS, modern APIs
SEO90+๐ŸŽฏ TargetMeta tags, structured data, crawlability

๐ŸŽฎ Game Rendering Targets

MetricDesktop TargetMobile TargetDescription
Frame Rate60fps55fps+Three.js scene rendering
Frame Budget<16.67ms<18.18msPer-frame processing time
Draw Calls<100<50WebGL draw call budget
Triangle Count<100K<50KScene geometry budget
Texture Memory<256MB<128MBGPU texture allocation
Scene Load<2s<3sInitial scene loading time

โšก Page Load Time Targets

MetricTargetMeasurement Point
Initial Load<2 secondsGitHub Pages / S3 deployment
Time to Interactive (TTI)<3 secondsLighthouse audit
First Contentful Paint (FCP)<1.5 secondsCore Web Vitals
Largest Contentful Paint (LCP)<2.5 secondsCore Web Vitals
Cumulative Layout Shift (CLS)<0.1Core Web Vitals
Three.js Canvas Ready<1.5 secondsWebGL context creation

๐Ÿ“ฆ Bundle Size Analysis

Build Output (Current):

Bundle Analysis (gzipped):
โ”œโ”€โ”€ index.js                    ~15 KB    โœ… Core app shell
โ”œโ”€โ”€ react-vendor.js             ~60 KB    ๐Ÿ“ฆ React 19 + ReactDOM runtime
โ”œโ”€โ”€ three-vendor.js            ~150 KB    ๐ŸŽฎ Three.js core
โ”œโ”€โ”€ fiber-drei.js               ~80 KB    โš›๏ธ @react-three/fiber + drei
โ”œโ”€โ”€ game-components.js          ~40 KB    ๐Ÿฅ‹ Combat system components
โ”œโ”€โ”€ audio-vendor.js             ~25 KB    ๐ŸŽต Howler.js audio engine
โ”œโ”€โ”€ CSS Assets                  ~10 KB    ๐ŸŽจ Styles
โ””โ”€โ”€ Total Bundle              ~380 KB    โœ… Within 500 KB budget

Performance Status:

  • โœ… Initial Bundle: Under 500 KB budget
  • โœ… Three.js Optimized: Tree-shaking applied
  • โœ… Code Splitting: Lazy-loaded non-critical components
  • โœ… Asset Optimization: WebM/Opus audio, compressed textures

๐ŸŽฏ Performance Budget

Performance budgets are defined in budget.json and enforced via Lighthouse CI:

[
  {
    "path": "/*",
    "timings": [
      { "metric": "interactive", "budget": 6000 },
      { "metric": "first-contentful-paint", "budget": 3500 },
      { "metric": "largest-contentful-paint", "budget": 4000 },
      { "metric": "total-blocking-time", "budget": 1600 },
      { "metric": "cumulative-layout-shift", "budget": 0.1 },
      { "metric": "speed-index", "budget": 5000 }
    ],
    "resourceSizes": [
      { "resourceType": "script", "budget": 180 },
      { "resourceType": "image", "budget": 200 },
      { "resourceType": "stylesheet", "budget": 50 },
      { "resourceType": "document", "budget": 20 },
      { "resourceType": "font", "budget": 50 },
      { "resourceType": "total", "budget": 500 }
    ],
    "resourceCounts": [
      { "resourceType": "third-party", "budget": 59 }
    ]
  }
]

๐Ÿงช Performance Testing Framework

Overview

The performance testing framework ensures the application meets both web performance and game rendering requirements:

  1. Lighthouse Audits โ€“ Web performance, accessibility, best practices, SEO
  2. Three.js Rendering Profiling โ€“ Frame rate, draw calls, memory usage
  3. Bundle Size Monitoring โ€“ Build output analysis via budget.json
  4. E2E Performance Testing โ€“ Cypress-based interaction and load testing
  5. CI Integration โ€“ Automated performance testing in GitHub Actions

Key Components

%%{init: {'theme':'base', 'themeVariables': {'primaryColor':'#2979FF','primaryTextColor':'#fff','primaryBorderColor':'#0D47A1','lineColor':'#00C853','secondaryColor':'#FFD600','tertiaryColor':'#FF3D00'}}}%%
graph TB
    A["๐Ÿ‘จโ€๐Ÿ’ป Code Changes"] --> B["๐Ÿ”จ Build Application"]
    B --> C{"๐Ÿ“ฆ Bundle Size Check"}
    C -->|โœ… Within Budget| D["๐Ÿš€ Deploy to Staging"]
    C -->|โŒ Over Budget| E["โšก Optimize & Rebuild"]
    E --> B
    D --> F["๐Ÿ” Lighthouse Audit"]
    F --> G{"๐Ÿ“Š Scores >90?"}
    G -->|โŒ Below Target| H["๐Ÿ”ง Performance Optimization"]
    G -->|โœ… Pass| I["๐ŸŽฎ Three.js Profiling"]
    I --> J{"๐ŸŽฏ 60fps Stable?"}
    J -->|โŒ Frame Drops| H
    J -->|โœ… Pass| K["โœ… Deploy to Production"]
    H --> F

    style A fill:#e3f2fd
    style K fill:#c8e6c9
    style H fill:#ffcdd2
    style C fill:#fff9c4
    style G fill:#fff9c4
    style J fill:#fff9c4

๐Ÿ”ฌ Performance Testing Procedures

1. Lighthouse Audit Execution

Local Testing:

# Install Lighthouse CLI
npm install -g lighthouse

# Run Lighthouse audit
lighthouse https://blacktrigram.com/ --view

# Run with budget validation
lighthouse https://blacktrigram.com/ \
  --budget-path=./budget.json \
  --output=html \
  --output-path=./lighthouse-report.html

2. Bundle Size Analysis

# Build application and analyze
npm run build

# Check build output sizes
npm run build:analyze

# View detailed build output
du -sh build/assets/*

3. Three.js Performance Profiling

In-Game Profiling:

import { useFrame } from '@react-three/fiber';
import { Stats } from '@react-three/drei';

// Add Stats component in development
{process.env.NODE_ENV === 'development' && <Stats />}

// Monitor frame time in useFrame
useFrame((state, delta) => {
  // delta should be ~0.0167 (60fps) or less
  if (delta > 0.02) {
    console.warn('Frame drop detected:', (1/delta).toFixed(1), 'fps');
  }
});

Key Metrics to Monitor:

  • Frame Time: Target <16.67ms (60fps)
  • Draw Calls: Monitor via renderer.info.render.calls
  • Triangles: Monitor via renderer.info.render.triangles
  • Textures: Monitor via renderer.info.memory.textures
  • Geometries: Monitor via renderer.info.memory.geometries

4. E2E Performance Testing with Cypress

# Run all E2E tests including performance checks
npm run test:e2e

# Run specific performance-related tests
npx cypress run --spec "cypress/e2e/**/performance*"

๐ŸŽฎ Three.js Optimization Best Practices

Rendering Optimization

  • โœ… Instanced Rendering: Use <Instances> for repeated geometry (particles, indicators)
  • โœ… LOD (Level of Detail): Use <Detailed> for distance-based mesh complexity
  • โœ… Frustum Culling: Enabled by default in Three.js, ensure meshes are properly bounded
  • โœ… Object Pooling: Reuse Three.js objects instead of creating/destroying per frame
  • โœ… Geometry Merging: Combine static geometry with BufferGeometryUtils.mergeGeometries()

Memory Management

  • โœ… Dispose Resources: Always call .dispose() on geometries, materials, textures in useEffect cleanup
  • โœ… Memoize Objects: Use useMemo for geometries and materials that don't change
  • โœ… Texture Compression: Use KTX2/Basis Universal for compressed GPU textures
  • โœ… Avoid Frame Allocations: Never create new THREE.Vector3() inside useFrame

React/Three.js Integration

  • โœ… Minimize Re-renders: Use React.memo() for Three.js components
  • โœ… useFrame Efficiency: Keep useFrame callbacks lightweight (<5ms)
  • โœ… Ref-based Updates: Mutate refs directly instead of using React state for animations
  • โœ… Lazy Loading: Use React.lazy() for non-critical scene components

๐Ÿ“ˆ Performance Regression Prevention

Automated Monitoring

GitHub Actions Integration:

  • โœ… Bundle size monitoring with budget.json
  • โœ… Lighthouse CI checks via workflow
  • โœ… Performance assertions in E2E tests
  • โœ… Build time monitoring

Testing Checklist

Before Release:

  • Lighthouse audit scores >90 (all categories)
  • Bundle size within budget (<500 KB initial)
  • Core Web Vitals pass (LCP <2.5s, CLS <0.1)
  • 60fps stable on desktop (Chrome, Firefox, Safari)
  • 55fps+ on mobile devices
  • No memory leaks in Three.js scene (30-minute stress test)
  • Draw calls within budget (<100 desktop, <50 mobile)
  • E2E performance tests pass
  • No performance regressions detected

๐Ÿ“Š Compliance & Standards Alignment

ISO/IEC 27001:2022:

  • A.8.6 (Capacity Management): Performance budgets and monitoring ensure adequate capacity for business requirements
  • A.8.9 (Configuration Management): Performance monitoring ensures system stability during configuration and system changes

NIST Cybersecurity Framework:

  • ID.AM-1 (Asset Management): Performance characteristics documented as part of asset inventory
  • PR.IP-2 (Information Protection): Performance testing ensures security controls don't degrade UX

CIS Controls:

  • 16.12 (Application Software Security): Performance testing validates security controls
  • 16.13 (Application Performance Monitoring): Continuous monitoring ensures availability

Hack23 ISMS:


๐Ÿ”— Performance Evidence & Reports

Live Performance Resources


๐Ÿ“‹ Document Owner: CEO | ๐Ÿ“… Last Updated: February 2026
๐Ÿ”„ Review Cycle: Quarterly | โฐ Next Review: May 2026