-
Notifications
You must be signed in to change notification settings - Fork 11
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
feat: 增加编译耗时的统计 #657
Draft
yiiqii
wants to merge
6
commits into
main
Choose a base branch
from
feat/compile-time-main
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.
Draft
feat: 增加编译耗时的统计 #657
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
57146a6
feat: 增加编译耗时的统计
yiiqii 42ec597
fix: compsition push twice
yiiqii d7f721d
chore(demo): 补充性能测试案例
yiiqii 8a68afd
chore(demo): 独立 shader 编译测试页面
yiiqii 553573a
fix: demo update
yiiqii 93dd1e1
fix: first frame time
yiiqii File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,52 @@ | ||
import type { Composition } from '@galacean/effects'; | ||
import { Player } from '@galacean/effects'; | ||
import '@galacean/effects-plugin-spine'; | ||
|
||
const json = 'https://mdn.alipayobjects.com/mars/afts/file/A*CquWQrVCGyUAAAAAAAAAAAAADlB4AQ'; | ||
// 大量粒子 | ||
// const json = 'https://mdn.alipayobjects.com/mars/afts/file/A*aCeuQ5RQZj4AAAAAAAAAAAAADlB4AQ'; | ||
// 新年烟花 | ||
const json = [ | ||
'https://gw.alipayobjects.com/os/gltf-asset/mars-cli/ILDKKFUFMVJA/1705406034-80896.json', | ||
'https://mdn.alipayobjects.com/graph_jupiter/afts/file/A*qTquTKYbk6EAAAAAAAAAAAAADsF2AQ', | ||
]; | ||
// 混合测试 | ||
// const json = [ | ||
// 'https://mdn.alipayobjects.com/mars/afts/file/A*QyX8Rp-4fmUAAAAAAAAAAAAADlB4AQ', | ||
// 'https://mdn.alipayobjects.com/mars/afts/file/A*bi3HRobVsk8AAAAAAAAAAAAADlB4AQ', | ||
// 'https://mdn.alipayobjects.com/graph_jupiter/afts/file/A*sEdkT5cdXGEAAAAAAAAAAAAADsF2AQ', | ||
// ]; | ||
// 塔奇 | ||
// const json = 'https://mdn.alipayobjects.com/mars/afts/file/A*uU2JRIjcLIcAAAAAAAAAAAAADlB4AQ'; | ||
// const json = 'https://gw.alipayobjects.com/os/gltf-asset/mars-cli/TAJIINQOUUKP/-799304223-0ee5d.json'; | ||
const container = document.getElementById('J-container'); | ||
|
||
(async () => { | ||
try { | ||
const player = new Player({ | ||
container, | ||
}); | ||
document.getElementById('J-button')!.addEventListener('click', () => { | ||
(async () => { | ||
try { | ||
container?.classList.add('active'); | ||
|
||
await player.loadScene(json); | ||
} catch (e) { | ||
console.error('biz', e); | ||
} | ||
})(); | ||
const player = new Player({ | ||
container, | ||
// renderFramework: 'webgl2', | ||
}); | ||
const compositions = await player.loadScene(Array.isArray(json) ? json : [json]) as unknown as Composition[]; | ||
|
||
compositions.forEach(composition => { | ||
const div = document.createElement('div'); | ||
|
||
div.innerHTML = `>>>>> composition: ${composition.name}`; | ||
document.getElementById('J-statistic')?.appendChild(div); | ||
|
||
for (const key in composition.statistic) { | ||
const p = document.createElement('li'); | ||
|
||
// @ts-expect-error | ||
p.innerHTML = `${key}: ${composition.statistic[key]}`; | ||
document.getElementById('J-statistic')?.appendChild(p); | ||
} | ||
}); | ||
} catch (e) { | ||
console.error('biz', e); | ||
} | ||
})(); | ||
}); |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enhance error handling for better debugging and user feedback
While the current error handling logs errors to the console, consider enhancing it to provide more detailed information and better user feedback.
Here's a suggested improvement:
This enhancement:
Additionally, consider implementing a more robust error handling strategy, such as using a dedicated error logging service for production environments.