移除ci性能测试,github下不应该测试这些文件
This commit is contained in:
@@ -4,7 +4,7 @@ module.exports = {
|
|||||||
testEnvironment: 'node',
|
testEnvironment: 'node',
|
||||||
roots: ['<rootDir>/tests'],
|
roots: ['<rootDir>/tests'],
|
||||||
testMatch: ['**/*.test.ts', '**/*.spec.ts'],
|
testMatch: ['**/*.test.ts', '**/*.spec.ts'],
|
||||||
testPathIgnorePatterns: ['/node_modules/', '\\.performance\\.test\\.ts$'],
|
testPathIgnorePatterns: ['/node_modules/', '\\.performance\\.test\\.ts$', '/tests/performance/'],
|
||||||
collectCoverage: false,
|
collectCoverage: false,
|
||||||
collectCoverageFrom: [
|
collectCoverageFrom: [
|
||||||
'src/**/*.ts',
|
'src/**/*.ts',
|
||||||
|
|||||||
28
packages/core/jest.performance.config.cjs
Normal file
28
packages/core/jest.performance.config.cjs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
||||||
|
module.exports = {
|
||||||
|
preset: 'ts-jest',
|
||||||
|
testEnvironment: 'node',
|
||||||
|
roots: ['<rootDir>/tests'],
|
||||||
|
testMatch: ['**/performance/**/*.test.ts', '**/*.performance.test.ts'],
|
||||||
|
collectCoverage: false,
|
||||||
|
verbose: true,
|
||||||
|
transform: {
|
||||||
|
'^.+\\.tsx?$': ['ts-jest', {
|
||||||
|
tsconfig: 'tsconfig.json',
|
||||||
|
useESM: false,
|
||||||
|
}],
|
||||||
|
},
|
||||||
|
moduleNameMapper: {
|
||||||
|
'^@/(.*)$': '<rootDir>/src/$1',
|
||||||
|
},
|
||||||
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
|
||||||
|
setupFilesAfterEnv: ['<rootDir>/tests/setup.ts'],
|
||||||
|
testTimeout: 30000,
|
||||||
|
clearMocks: true,
|
||||||
|
restoreMocks: true,
|
||||||
|
modulePathIgnorePatterns: [
|
||||||
|
'<rootDir>/bin/',
|
||||||
|
'<rootDir>/dist/',
|
||||||
|
'<rootDir>/node_modules/'
|
||||||
|
]
|
||||||
|
};
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Component } from '../../../src/ECS/Component';
|
import { Component } from '../../src/ECS/Component';
|
||||||
import { ComponentStorage, ComponentStorageManager, EnableSoA } from '../../../src/ECS/Core/ComponentStorage';
|
import { ComponentStorage, ComponentStorageManager, EnableSoA } from '../../src/ECS/Core/ComponentStorage';
|
||||||
import { SoAStorage } from '../../../src/ECS/Core/SoAStorage';
|
import { SoAStorage } from '../../src/ECS/Core/SoAStorage';
|
||||||
|
|
||||||
// 测试用统一组件结构(启用SoA)
|
// 测试用统一组件结构(启用SoA)
|
||||||
@EnableSoA
|
@EnableSoA
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { EntityManager } from '../../../src/ECS/Core/EntityManager';
|
import { EntityManager } from '../../src/ECS/Core/EntityManager';
|
||||||
import { ComponentTypeManager } from '../../../src/ECS/Utils/ComponentTypeManager';
|
import { ComponentTypeManager } from '../../src/ECS/Utils/ComponentTypeManager';
|
||||||
import { Entity } from '../../../src/ECS/Entity';
|
import { Entity } from '../../src/ECS/Entity';
|
||||||
|
|
||||||
describe('详细性能分析 - 逐步测量', () => {
|
describe('详细性能分析 - 逐步测量', () => {
|
||||||
let entityManager: EntityManager;
|
let entityManager: EntityManager;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { EntityManager } from '../../../src/ECS/Core/EntityManager';
|
import { EntityManager } from '../../src/ECS/Core/EntityManager';
|
||||||
import { ComponentTypeManager } from '../../../src/ECS/Utils/ComponentTypeManager';
|
import { ComponentTypeManager } from '../../src/ECS/Utils/ComponentTypeManager';
|
||||||
|
|
||||||
describe('实体创建性能分析', () => {
|
describe('实体创建性能分析', () => {
|
||||||
let entityManager: EntityManager;
|
let entityManager: EntityManager;
|
||||||
@@ -59,7 +59,7 @@ describe('实体创建性能分析', () => {
|
|||||||
const directEntities: any[] = [];
|
const directEntities: any[] = [];
|
||||||
for (let i = 0; i < entityCount; i++) {
|
for (let i = 0; i < entityCount; i++) {
|
||||||
// 直接创建Entity,不通过EntityManager的复杂逻辑
|
// 直接创建Entity,不通过EntityManager的复杂逻辑
|
||||||
directEntities.push(new (require('../../../src/ECS/Entity').Entity)(`Direct_${i}`, i));
|
directEntities.push(new (require('../../src/ECS/Entity').Entity)(`Direct_${i}`, i));
|
||||||
}
|
}
|
||||||
endTime = performance.now();
|
endTime = performance.now();
|
||||||
console.log(`4. 直接创建Entity: ${(endTime - startTime).toFixed(2)}ms`);
|
console.log(`4. 直接创建Entity: ${(endTime - startTime).toFixed(2)}ms`);
|
||||||
@@ -91,7 +91,7 @@ describe('实体创建性能分析', () => {
|
|||||||
|
|
||||||
// 步骤2: Entity创建
|
// 步骤2: Entity创建
|
||||||
stepTime = performance.now();
|
stepTime = performance.now();
|
||||||
const entity = new (require('../../../src/ECS/Entity').Entity)(name, id);
|
const entity = new (require('../../src/ECS/Entity').Entity)(name, id);
|
||||||
stepTimes['Entity创建'] = (stepTimes['Entity创建'] || 0) + (performance.now() - stepTime);
|
stepTimes['Entity创建'] = (stepTimes['Entity创建'] || 0) + (performance.now() - stepTime);
|
||||||
|
|
||||||
// 步骤3: 各种索引更新
|
// 步骤3: 各种索引更新
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Entity } from '../../../src/ECS/Entity';
|
import { Entity } from '../../src/ECS/Entity';
|
||||||
import { BigIntFactory } from '../../../src/ECS/Utils/BigIntCompatibility';
|
import { BigIntFactory } from '../../src/ECS/Utils/BigIntCompatibility';
|
||||||
import { ComponentType } from '../../../src/ECS/Core/ComponentStorage';
|
import { ComponentType } from '../../src/ECS/Core/ComponentStorage';
|
||||||
|
|
||||||
describe('初始化方式性能对比', () => {
|
describe('初始化方式性能对比', () => {
|
||||||
test('对比不同初始化方式的性能', () => {
|
test('对比不同初始化方式的性能', () => {
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { EntityManager } from '../../../src/ECS/Core/EntityManager';
|
import { EntityManager } from '../../src/ECS/Core/EntityManager';
|
||||||
import { ComponentTypeManager } from '../../../src/ECS/Utils/ComponentTypeManager';
|
import { ComponentTypeManager } from '../../src/ECS/Utils/ComponentTypeManager';
|
||||||
import { Entity } from '../../../src/ECS/Entity';
|
import { Entity } from '../../src/ECS/Entity';
|
||||||
|
|
||||||
describe('优化后的性能分析 - ComponentIndexManager优化', () => {
|
describe('优化后的性能分析 - ComponentIndexManager优化', () => {
|
||||||
let entityManager: EntityManager;
|
let entityManager: EntityManager;
|
||||||
Reference in New Issue
Block a user