-
Notifications
You must be signed in to change notification settings - Fork 56
feat: Integrate adaptive performance system with GPUComposer #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
CripterHack
wants to merge
20
commits into
amandaghassaei:main
Choose a base branch
from
CripterHack:feat/auto-perf-profile
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: Integrate adaptive performance system with GPUComposer #16
CripterHack
wants to merge
20
commits into
amandaghassaei:main
from
CripterHack:feat/auto-perf-profile
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Add comprehensive auto-performance profiling module with TypeScript types - Implement device capability detection and quality preset selection - Add performance monitoring hooks in GPUComposer tick() and resize() methods - Export performance module in main index.ts for public API access - Include built distribution files with new functionality
- Add autoPerformanceProfile parameter to GPUComposer constructor and initWithThreeRenderer - Implement performance monitoring hooks in tick() and resize() methods - Add private _autoProfileOptions property for configuration storage - Enable dynamic quality adjustment callbacks for real-time performance optimization
- Fix Object.values() compatibility issues by casting Object to any - Add explicit type annotations for forEach parameters - Fix gl.bufferData type error in GPUIndexBuffer by ensuring typed arrays - Add fallback for saveAs UMD global in GPUComposer These errors existed before the auto-performance profiling implementation.
- Rebuild dist files with resolved TypeScript compilation issues - Updated source maps and minified versions
- Update lib from es2015 to es2020 in tsconfig.json - Resolves BigUint64Array and BigInt64Array compatibility issues - Required for @petamoriken/float16 dependency used in GPULayer
Add new documentation for performance module including interfaces for quality presets, device capabilities, and auto-profiling options. Also updates GPUComposer docs to include new autoPerformanceProfile parameter.
- Add PerformanceAdapter class for real-time FPS monitoring - Add autoProfile module with quality presets and device detection - Implement 5-tier quality system (Ultra, High, Medium, Low, Potato) - Add automatic performance adjustment based on target FPS - Include device capability detection for optimal defaults
- Add autoPerformanceProfile option to constructor parameters - Implement setQualityPreset(), getCurrentQualityPreset(), resetPerformanceConfig() APIs - Add setPerformanceDebugLogging() for debugging support - Integrate PerformanceAdapter for automatic FPS-based adjustments - Add _debugPerformance property cleanup in dispose() method - Maintain full backward compatibility with existing APIs
- Update compiled JavaScript bundles with new performance features - Include TypeScript definitions for new APIs - Update source maps for debugging support - Ensure all new performance APIs are available in production build
- Update GPUComposer class documentation with new performance methods - Add AutoProfileOptions interface documentation - Update performance module documentation with new exports - Include comprehensive API reference for quality presets and adapters
- Add explicit plugin configuration to karma.conf.js - Create temporary TypeChecks implementation for test compatibility - Fix ES module compatibility issues in testing environment - Ensure all 181 tests pass with backward compatibility maintained
- Update package.json with new testing dependencies - Add pnpm-lock.yaml with resolved dependency versions - Ensure consistent dependency resolution across environments - Include karma testing framework plugins for CI/CD compatibility
- Add comprehensive auto-profile module with device capability detection - Implement quality preset system (high, medium, low, minimal) - Add browser environment detection (reduced motion, data saver) - Integrate auto-profile functionality into GPUComposer - Support automatic quality adjustment based on device capabilities - Include FPS-based performance monitoring and downgrade logic
- Add complete test suite for auto-profile functionality - Test device capability detection and scoring logic - Test quality preset selection based on device capabilities - Test browser environment detection (reduced motion, data saver) - Test FPS monitoring and performance downgrade logic - Update karma configuration to include new test file - Fix test expectations to match corrected scoring thresholds
- Create comprehensive auto-performance demo with fluid simulation - Add interactive UI controls for quality presets and auto-profile settings - Include real-time performance monitoring with FPS display - Demonstrate automatic quality adjustment based on device capabilities - Add device capability detection display in UI - Update examples index and README with new auto-performance section - Provide visual feedback for performance optimization in action
- Update GPUComposer documentation with new auto-profile methods - Add comprehensive performance module documentation - Document all auto-profile interfaces and types - Add testing performance matrix for cross-device validation - Include detailed API reference for quality presets and device detection - Document browser environment detection capabilities
- Add comprehensive Performance Auto-Tuning section with usage examples - Document automatic quality adjustment based on device capabilities - Include code examples for manual and automatic quality preset selection - Explain device capability detection and browser environment awareness - Add links to interactive auto-performance example - Provide clear guidance on performance optimization strategies
- Rebuild TypeScript definitions with new performance interfaces - Update minified and unminified JavaScript bundles - Include performance auto-profile functionality in distribution - Update source maps for debugging support - Ensure all new APIs are available in built package
…ne Essentials plugin, and clean logs in auto-performance
- Rewrite README to be more concise and focused on key features - Add comprehensive usage guide with detailed examples - Improve quality preset comparison table with frame budget metrics - Document device detection logic and runtime adaptation behavior - Add accessibility and debugging sections
Author
|
@amandaghassaei |
Owner
|
This sounds really cool, thanks so much for the contribution! It's going to take me a few weeks to get some time to properly check this out, but I will get that done before the end of the year. Thanks again! - Amanda |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR integrates an adaptive performance system into GPU-IO via
GPUComposer, providing automatic quality tuning based on device capabilities and real-time FPS. It introduces an opt-inautoPerformanceProfileoption, quality presets, and a small set of public APIs for manual control. Backward compatibility is preserved.Key Features
high,medium,low,minimal) with tuned budgetsautoPerformanceProfile(boolean or options)setQualityPreset,getCurrentQualityPreset,resetPerformanceConfigsetPerformanceDebugLogging,debugLoggingoptionImplementation Details
Core Modules
src/performance/autoProfile.tsQUALITY_PRESETSandQUALITY_SEQUENCEdetectQualityProfile(capabilities)for initial preset selectiontranslatePresetToConfig(preset)mapping preset → runtime configsrc/PerformanceAdapter.tsapplyPreset()andapplyQualityPreset()utilitiessrc/GPUComposer.tsautoPerformanceProfileoption to the constructor_autoProfileOptionsand_performanceAdapterwhen enabledtick()to monitor FPS and adjust quality:60(configurable viaautoPerformanceProfile.targetFPS)fps < targetFPS * 0.8fps > targetFPS * 1.2(checked less frequently: every 120 ticks)setQualityPreset(presetId)getCurrentQualityPreset()→ returnsQualityPreset | nullresetPerformanceConfig()→ revert to originalsetPerformanceDebugLogging(enabled)_debugPerformanceindispose()Quality Presets
Presets are tuned for fluid simulation defaults and include a frame budget:
high:frameBudget: 22ms, particle-heavy, 3 render passesmedium:frameBudget: 28ms, balanced, 2 passeslow:frameBudget: 32ms, performance-focused, 1 passminimal:frameBudget: 36ms, maximal performance, 1 passExact fields are defined in
QualityPresetand translated viatranslatePresetToConfig().Default Behavior
autoPerformanceProfileis enabled:profileIdis provided, the initial preset uses that valuedetectQualityProfile()(considers WebGL2, memory, cores, DPI, reduced-motion, data-saver)tick()publishes metrics and performs upgrades/downgrades using 20% thresholdsUsage Examples
Tests & Docs
tests/mocha/performanceAutoProfile.jsexercises detection, thresholds, and APIskarma.conf.jsaddsChromeLowSpec/ChromeHighSpeclaunchers for performance scenariosdocs/auto_profile_usage_guide.mdwith code samples and behavior detailsexamples/auto-performance/interactive demo (FPS, current preset, manual overrides)Browser & Accessibility
prefers-reduced-motion(auto-selectsminimal, can be overridden withprofileId)navigator.connection.saveDatato request downgrades via callbackBackward Compatibility
Verification Checklist
pnpm build)Future Work