Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
407 commits
Select commit Hold shift + click to select a range
1237991
Add disposable stash tests
Dec 25, 2024
8d1a487
Update MorpehComponentHelpersSemantic.cs
Dec 25, 2024
0b0e913
Simplify
Dec 25, 2024
4a6f27e
Allow injecting classes only
Dec 25, 2024
ff8cdea
Check parameterless constructors for non-system/non-initializer fields
Dec 25, 2024
5abf257
Rename for clarity
Dec 25, 2024
06c8d5a
Update DisposableComponent.cs
Dec 25, 2024
ad4e1bc
Add meaningful tests for components
Dec 25, 2024
52bba80
Check interface generation
Dec 25, 2024
6befbd2
Test generic components
Dec 25, 2024
f746308
Check diagnostics of components
Dec 25, 2024
30f7c5c
Report a warning if an initializer has OnUpdate method with a float
Dec 25, 2024
354d314
Update InitializerSourceGenerator.cs
Dec 25, 2024
99faef4
Switch to method declaration usage
Dec 25, 2024
90b0828
Delete monoprovider (replacement exists)
Dec 25, 2024
55d921b
Delete systems counter from metrics
Dec 25, 2024
1eb25f6
Move diagnostics down
Dec 25, 2024
44fb014
Formatting
Dec 25, 2024
0a8c5d9
NativeDisposableStash
Dec 25, 2024
565845c
Hide under defines
Dec 25, 2024
69b9dbb
Il2cpp attributes
Dec 25, 2024
aabfa8c
Remove linq from modifiers detection
Dec 25, 2024
35a0525
Force linq usages to be static
Dec 25, 2024
8ca39a6
First set of fixes after testing
Dec 26, 2024
702a1bf
Fix attribute value prefix
Dec 26, 2024
a3e9138
TODO
Dec 26, 2024
cc23247
TODOs
Dec 26, 2024
71cc2ab
Use fully qualified logger paths
Dec 27, 2024
3168f39
Allow stash specialization to be disabled with a preprocessor define …
Dec 27, 2024
1ed1a8f
Fix incorrect generic constraint construction
Dec 27, 2024
c844012
TODO
Dec 27, 2024
9d4423a
Completely custom loops with names
Dec 28, 2024
5dc1602
Make defining world optional in systems/initializers
Dec 28, 2024
fd0d63c
Test different scenarios
Dec 28, 2024
ccebd84
Fix missing defines, add todo
Dec 28, 2024
579bbef
Rename for clarity
Dec 28, 2024
0620943
Make requirements readonly
Dec 28, 2024
a03dcb9
Autogenerate only getter
Dec 28, 2024
4f700d3
Add profiling for system groups
Dec 28, 2024
c9ca0b5
Rename to avoid collisions
Dec 28, 2024
172b26e
Simplify injection generation for better performance
Jan 6, 2025
6d61ce1
Get rid of full semantic model from runner generator
Jan 6, 2025
16edd0f
Add profiling to runner
Jan 6, 2025
b17fc0a
Reuse FQDNs in injection generator
Jan 6, 2025
4f2b4c1
Reduce FQDN string creation for specialization
Jan 6, 2025
079fd50
Move validatable interfaces away
Jan 6, 2025
d6cdc6d
Implement interfaces for systems & initializers for easier creation
Jan 6, 2025
9b7ad2a
Convert kind detection to a switch instead of calling IsKind every time
Jan 6, 2025
6eaf5d3
Add fiddle for same name components inside the same namespace
Jan 6, 2025
4b70fbb
Add stashes to BasicGenericSystem for testing
Jan 6, 2025
597b3e6
Restructure
Jan 7, 2025
d215a9a
Add fiddle code for injection
Jan 7, 2025
ef30da2
Rename injectable to inject
Jan 7, 2025
2244ea6
Simplify, speed up, add TODOs
Jan 7, 2025
d82b7a3
Skip checking static members
Jan 7, 2025
d1a8de4
TODO
Jan 7, 2025
09eb025
Support fast & slow methods of finding injectable types
Jan 7, 2025
7f7a0b0
Support fast and slow scans in systems group
Jan 7, 2025
d784b74
Remove unnecessary attributes extraction, don't scan interfaces unles…
Jan 7, 2025
aeb3898
Remove method unless slow mode
Jan 7, 2025
f77c11e
Complete support for hierarchy-based injection with private fields
Jan 8, 2025
8b953f7
Fix static detection mismatch between implementations
Jan 8, 2025
0e0cc42
protected -> private for fiddle
Jan 8, 2025
32f6df5
Merge into one loop
Jan 8, 2025
ccf949b
Use thread static list cache
Jan 8, 2025
690a441
Basic tests for injection functionality
Jan 8, 2025
eba1532
Forgot this test
Jan 8, 2025
a9a6aa4
Add extra test for middleware class
Jan 8, 2025
b849054
Simplify monoprovider generator for less string creations
Jan 8, 2025
07c210b
Use simpler hashing for suffixes
Jan 8, 2025
32f9890
Remove full semantic model from systems group source generator
Jan 9, 2025
178bda1
Codestyle
Jan 9, 2025
16076e2
Allow profiling to be replaced with Unity's profiler on demand
Jan 9, 2025
a8321b8
Allow systems groups to be structs
Jan 9, 2025
3b5b238
Fix attribute usage for system and initializer
Jan 9, 2025
b60df0a
Report nested declaration errors for all generators
Jan 9, 2025
9a5ae87
Use shared pool across threads
Jan 10, 2025
0141063
Cache-testing for source generators, simplify component source genera…
Jan 10, 2025
33a69e0
Remove unnecessary appends
Jan 10, 2025
7518242
Forbid semantic model in DTO
Jan 10, 2025
f50ae86
Fix forbidden types check
Jan 10, 2025
ddc9c8b
Reduce strings usage
Jan 10, 2025
f6363c9
Move down
Jan 10, 2025
b52d5c1
Cache-friendly system & initializer source generator with caching tests
Jan 11, 2025
f862ffe
Simplify getting stash requirements
Jan 11, 2025
4cc232d
Cleanup
Jan 11, 2025
ab01a4b
Use ImmutableArray under the hood of EquatableArray
Jan 11, 2025
8c660f9
Update EquatableArray.cs
Jan 11, 2025
5c298e0
Revert "Update EquatableArray.cs"
Jan 11, 2025
e9ce999
Revert "Use ImmutableArray under the hood of EquatableArray"
Jan 11, 2025
cea9a75
Add non-boxing enumerator to equatable array
Jan 11, 2025
8a14981
Just use record structs
Jan 11, 2025
67f70c7
Cache-friendly version generic resolvers extraction
Jan 11, 2025
b93b913
Faster disposable check for systems group
Jan 11, 2025
fc187d0
Move to record structs
Jan 11, 2025
8ef9cc0
Update InjectionSourceGenerator.cs
Jan 11, 2025
c1c66f6
Rename
Jan 11, 2025
857392e
Cache-friendly version of MonoProvider sourcegen. Make IValidatable/I…
Jan 11, 2025
32618ff
Add tracking names to monoprovider generator
Jan 11, 2025
f28489a
Incorrect visibility modifier
Jan 11, 2025
8a73197
Get only necessary stuff
Jan 11, 2025
d7e57ec
TODO
Jan 11, 2025
dca1c5d
Start making separate pipelines
Jan 11, 2025
0ed8016
Start creating pipelines
Jan 11, 2025
ef3d13d
TODOs
Jan 11, 2025
2ee4038
Fix groups and runners trying to generate inside a parent type
Jan 11, 2025
5fea7d2
TODO
Jan 11, 2025
60684c9
Simplify component transformation
Jan 12, 2025
aa69f26
Unify logic between extractions
Jan 12, 2025
95c2a29
Start implementing logging
Jan 12, 2025
e252f56
ImmutableArray.First() uses Enumerable under the hood
Jan 13, 2025
ddd4276
Compiler services
Jan 13, 2025
9f1759a
Move systems & initializers to a separate pipeline
Jan 13, 2025
0cabafe
Speed up stash requirements construction
Jan 13, 2025
eb0b2bb
Simplify and speed up getting generic information
Jan 13, 2025
30b7600
Wrap try-catch blocks
Jan 13, 2025
28113f8
Delete enumerator from equatable array
Jan 13, 2025
3c18c5a
Logs
Jan 13, 2025
18b5147
Logger TODO
Jan 13, 2025
c1c6163
Generate providers only in unity
Jan 13, 2025
1b0d339
Allow sourcegens to be debugged in Rider in Fiddle project
Jan 14, 2025
cf376e6
Fix interface for systems, add another interface for always enabled s…
Jan 15, 2025
3dd22a7
One attribute for injection
Jan 15, 2025
b2ad815
Start remaking systems group sourcegen
Jan 16, 2025
5d44219
Finish runner rework
Jan 16, 2025
ccacb44
Cleanup
Jan 16, 2025
542c5cd
Remove generics support from runners and systems groups
Jan 16, 2025
1491fa0
Rename for consistency
Jan 16, 2025
f8d4a1c
Support any hierarchy of types
Jan 16, 2025
e2af5cb
Cleanup
Jan 16, 2025
c52868e
Support hierarchy in injection
Jan 16, 2025
66fd016
Support extra modifiers in hierarchy
Jan 16, 2025
1b2a7e4
Take stringbuilder once
Jan 16, 2025
e59c03e
Make injection its own pipeline with caching
Jan 17, 2025
79b90de
Combine with equatable array
Jan 17, 2025
80e55f4
Cleanup
Jan 17, 2025
c45bb18
TODO
Jan 17, 2025
50fc710
Cleanup
Jan 17, 2025
3cc0d63
Fix initializer hierarchy closing order
Jan 17, 2025
00351a9
Fix incorrect keywords for structs
Jan 17, 2025
1aa8598
Cleanup utilities
Jan 17, 2025
31d2775
Remove diagnostics
Jan 17, 2025
8654243
Skip logging if file is not writable
Jan 17, 2025
b2c7cec
Support any depth for includestash generics
Jan 17, 2025
b32d38b
Reduce unnecessary calls
Jan 17, 2025
3c5b820
Don't need to scan disposable if tag is detected already
Jan 17, 2025
79e1ac0
Cleanup
Jan 17, 2025
154f955
Cleanup
Jan 17, 2025
d518c47
Cleanup
Jan 17, 2025
148cf44
Allow specialization to be disabled by user code. Detect Unity as opt…
Jan 19, 2025
e2cac11
Use unity profiler if unity is detected, skipping MLogger interface c…
Jan 20, 2025
89d360c
Update SourceGenerators.csproj
Jan 20, 2025
9644e21
Cleanup attributes
Jan 20, 2025
ab480ae
Fix different symbol checks
Jan 20, 2025
dce355d
Use switch-case with enumeration as it enumerates anyway
Jan 20, 2025
a7c8043
Support custom field names for stash requirements
Jan 20, 2025
31fefca
Add calls to fiddle
Jan 20, 2025
0c5a9b9
Generate registration/deregistration code only if a registered field …
Jan 20, 2025
d181fed
Avoid expensive iterations if there are too many generic injection re…
Jan 20, 2025
29f186c
Force unbound generic type in pipeline
Jan 20, 2025
39a4d42
Fix incorrect profiling namespace
Jan 20, 2025
bb43964
TODO
Jan 20, 2025
4546e4e
Allow update methods to be optional in a runner/group
Jan 20, 2025
ff2a057
Fix incorrect order of modifiers for hierarchy classes
Jan 20, 2025
8a27c26
TODO
Jan 20, 2025
639cdc9
Fix profiler marker names if a type is inside an hierarchy of types
Jan 20, 2025
b696e63
Delete unused
Jan 20, 2025
ee1a73a
Simplify
Jan 21, 2025
d513f4f
Cleanup
Jan 21, 2025
a89a478
Allow injecting into properties
Jan 21, 2025
1bdb5f0
Fix incorrect detection
Jan 21, 2025
89a51a4
Test injectable properties
Jan 21, 2025
5241fd8
Add property to fiddle
Jan 21, 2025
205dc1d
Rename
Jan 21, 2025
508e722
Rename profiler markers for clarity
Jan 21, 2025
b41dd81
Fix Registration
Jan 21, 2025
9a3d93a
Update GroupPipeline.cs
Jan 21, 2025
b2f2a89
Create new injection table by default if it wasn't provided
Jan 21, 2025
32ec22e
Incorrect usage fix
Jan 21, 2025
0186b8b
We are guaranteed to have injection table in constructor now
Jan 21, 2025
73f68db
Fix extra closing bracket
Jan 21, 2025
4963822
Merge branch 'stage-2024.1' into stage-2025.1
Jan 23, 2025
d573a90
Fixes after merge
Jan 23, 2025
9d1aa16
Merge branch 'stage-2024.1' into stage-2025.1
Jan 23, 2025
6361ef3
Disable sourcegen logging
Jan 23, 2025
37d0992
Update version in package.json
Jan 23, 2025
9f9b953
Support slow component API with MORPEH_SOURCEGEN_ENABLE_SLOW_COMPONEN…
Jan 23, 2025
9340fab
TODO
Jan 23, 2025
8ebb137
Add slow api to fiddle
Jan 23, 2025
4de97d8
Make EntityExtensions non-obsolete as GetWorld will probably not be r…
Jan 23, 2025
37a6cb9
Liveliness checks for entities in slow API
Jan 23, 2025
95a4cd0
Fix errors in fiddle
Jan 23, 2025
11646f3
Add DataComponent to fiddle
Jan 23, 2025
1c7eaeb
Rework FilterDisposalTests to use stashes
Jan 23, 2025
c883cf6
Rework MigrationTests to use stashes
Jan 23, 2025
fe8ac0d
Rework FilterMatchTests to use stashes
Jan 23, 2025
1b786ae
Rework WorldTests to use stashes
Jan 23, 2025
a1df3e8
Cleanup entity extensions
Jan 23, 2025
abdcca3
TODO
Jan 23, 2025
9289565
Fix compilation errors in .NET ~8 and Csharp ~12 projects
Jan 24, 2025
af86b3d
Remove TODOs, add comments
Jan 24, 2025
bb1cf8a
ForceGenerateSlowApi for components generator
Jan 24, 2025
c34a2ac
Meta files, cleanup runtime helper after merge, delete icon setter as…
Jan 24, 2025
162db76
Merge branch 'stage-2024.1' into stage-2025.1
Jan 24, 2025
3c64d29
Rework EntityViewer to use boxed api & IComponent
Jan 24, 2025
ba66d80
Get rid of ExtendedComponentId, use boxed API in world browser
Jan 24, 2025
d83b655
Use IDataComponent for GetStash<T> calls
Jan 24, 2025
de57143
Remove TODO
Jan 24, 2025
23afc9a
Cleanup
Jan 24, 2025
90f3c76
Restore doNotDisableSystemOnException functionality
Gallardo994 Jan 30, 2025
709d6e7
Fix incorrect exception types in components slow api calls
Gallardo994 Jan 30, 2025
bbb879f
Add missing meta file
heymeepo Aug 9, 2025
289ed3e
Add MORPEH_SUPPRESS_OBSOLETE
heymeepo Aug 9, 2025
e090565
Fixing getting the same entity with + 2 generations when one of compo…
konrad-rzonca Nov 15, 2025
4b9ad7d
Fixing unintented change
konrad-rzonca Nov 15, 2025
4c0f653
Merge pull request #248 from konrad-rzonca/feature/fix-double-removal…
Gallardo994 Nov 28, 2025
0623c09
Remove expensive check in EntityProvider.Entity
heymeepo Dec 19, 2025
4ef7041
Fix MORPEH_EXTERNAL_IL2CPP_ATTRS introducing compiler errors
Gallardo994 Dec 27, 2025
0bf2a78
Remove typeName inside MonoProvider as it's not used anywhere
Gallardo994 Jan 5, 2026
5f70c4e
Fix #250 by making entityViewer lazy (#251)
Gallardo994 Jan 7, 2026
a4e48e6
Merge branch 'stage-2024.2' into stage-2025.1
Gallardo994 Feb 25, 2026
a8d5386
Fix tests
Gallardo994 Feb 25, 2026
b448f88
Support forceVariation for component stashes; add obsolete proxy meth…
Gallardo994 Apr 13, 2026
9c9962d
Add TagComponentForceData to fiddle
Gallardo994 Apr 13, 2026
67bc9e0
Add initial EcsSystemUpdateMiddleware support
Gallardo994 Apr 13, 2026
754187e
Add Disposable support to SystemUpdateMiddleware
Gallardo994 Apr 13, 2026
4ab5562
Add [IncludeStash] support for generated MonoProvider
Gallardo994 Apr 13, 2026
72cd854
Fix [IncludeStash] implementation
Gallardo994 Apr 13, 2026
5e9c980
Fix EntityExtensionsObsolete
Gallardo994 Apr 13, 2026
7eaf6d8
Update test & benchmark runner to newest packages & .NET 10
Gallardo994 Apr 13, 2026
1f1aeec
Fix StructuralChangesWithMultipleMatchesFilters
Gallardo994 Apr 13, 2026
141d5bf
Disable warnings & add autogenerated comment for all generators
Gallardo994 Apr 13, 2026
9a744f6
Replace define checks
Gallardo994 Apr 13, 2026
34d38a1
Make boxed API always available with lazy-init for TagStash
Gallardo994 Apr 15, 2026
025947f
Restore removed interface
Gallardo994 Apr 15, 2026
a945ee9
Fix injections behaviour with sealed classes when no overrides are av…
Gallardo994 Apr 15, 2026
ed4d6ce
Fix generic injectable types without generic resolvers producing garb…
Gallardo994 Apr 15, 2026
c00fc6d
Add Unity sourcegen DLL
Gallardo994 Apr 29, 2026
f23bed7
Separate Inject step from OnAwake
Gallardo994 Apr 29, 2026
253f04f
Add Unity 6.X support for BurstDetector
Gallardo994 Apr 30, 2026
f705dc3
Fix DoNotDisableSystemOnException sourcegen; fix Uniy 6.X support for…
Gallardo994 Apr 30, 2026
66c3c39
Delete OpenAssetProcessor as we don't have SO systems anymore
Gallardo994 Apr 30, 2026
a2cceab
Add Unity 6.2+ support for EditorSceneSetup
Gallardo994 Apr 30, 2026
98bb94a
Fix UnityEditor.Build namespace usage
Gallardo994 May 9, 2026
3f4275e
Fix using in BurstDetector
Gallardo994 May 9, 2026
dcfe06e
Make FastList<T>.comparer lazy when IndexOf is used
Gallardo994 Jun 2, 2026
bc832f0
Fix Unity 6 errors during domain reload
Gallardo994 Jul 10, 2026
9a4fab4
Make OnAwake/Dispose/World optional, update source generators
Gallardo994 Jul 22, 2026
2889228
Add system group middleware support
Gallardo994 Jul 22, 2026
08e0cf7
Support Unity 6.3+ & Unity 6.5+ versions of EntityId in EntityProvider
Gallardo994 Aug 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions Benchmarks/dotnet~/BenchmarkComponents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,37 @@

namespace Benchmarks;

public struct Test1 : IComponent {
[EcsComponent]
public partial struct IntTest1 {
public int value;
}

public struct Test2 : IComponent {
[EcsComponent]
public partial struct IntTest2 {
public int value;
}

public struct Test3 : IComponent {
[EcsComponent]
public partial struct IntTest3 {
public int value;
}

public struct Test4 : IComponent {
[EcsComponent]
public partial struct IntTest4 {
public int value;
}

[EcsComponent]
public partial struct TagTest1 {

}

[EcsComponent]
public partial struct TagTest2 {

}

[EcsComponent]
public partial struct TagTest3 {

}
7 changes: 4 additions & 3 deletions Benchmarks/dotnet~/Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.12" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.dotTrace" Version="0.13.12" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.13.12" />
<PackageReference Include="BenchmarkDotNet" Version="0.15.8" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.dotTrace" Version="0.15.8" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.15.8" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\Scellecs.Morpeh\Scellecs.Morpeh.csproj" />
<ProjectReference Include="..\..\SourceGenerators~\SourceGenerators\SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>

</Project>
18 changes: 7 additions & 11 deletions Benchmarks/dotnet~/IterationBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ public class IterationBenchmarks {

private World world;

private Stash<Test1> test1;
private Stash<Test2> test2;
private Stash<Test3> test3;
private Stash<IntTest1> intTest1;

private Filter filter;

Expand All @@ -22,17 +20,15 @@ public class IterationBenchmarks {
[GlobalSetup]
public void SetUp() {
this.world = World.Create();

this.intTest1 = IntTest1.GetStash(this.world);

this.test1 = this.world.GetStash<Test1>();
this.test2 = this.world.GetStash<Test2>();
this.test3 = this.world.GetStash<Test3>();

this.filter = this.world.Filter.With<Test1>().Build();
this.filter = this.world.Filter.With<IntTest1>().Build();

this.buffer = new Entity[Count];
for (var i = 0; i < Count; i++) {
this.buffer[i] = this.world.CreateEntity();
this.test1.Set(this.buffer[i], new Test1());
this.intTest1.Set(this.buffer[i], new IntTest1());
}

this.world.Commit();
Expand All @@ -41,7 +37,7 @@ public void SetUp() {
// [Benchmark]
public void ForeachFilterSingle() {
foreach (var entity in this.filter) {
this.test1.Get(entity).value++;
this.intTest1.Get(entity).value++;
}
}

Expand All @@ -52,7 +48,7 @@ public void ForeachFilterSingleManual() {
var entities = arch.entities;

for (var i = arch.length - 1; i >= 0; i--) {
this.test1.Get(entities[i]).value++;
this.intTest1.Get(entities[i]).value++;
}
}
}
Expand Down
95 changes: 74 additions & 21 deletions Benchmarks/dotnet~/MigrationsBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ public class MigrationsBenchmarks {

private World world;

private Stash<Test1> test1;
private Stash<Test2> test2;
private Stash<Test3> test3;
private Stash<IntTest1> intTest1;
private Stash<IntTest2> intTest2;
private Stash<IntTest3> intTest3;

private TagStash tagTest2;
private TagStash tagTest3;

private Filter filter;

Expand All @@ -27,63 +30,113 @@ public class MigrationsBenchmarks {
public void SetUp() {
this.world = World.Create();

this.test1 = this.world.GetStash<Test1>();
this.test2 = this.world.GetStash<Test2>();
this.test3 = this.world.GetStash<Test3>();
this.intTest1 = IntTest1.GetStash(this.world);
this.intTest2 = IntTest2.GetStash(this.world);
this.intTest3 = IntTest3.GetStash(this.world);

this.tagTest2 = TagTest2.GetStash(this.world);
this.tagTest3 = TagTest3.GetStash(this.world);

this.filter = this.world.Filter.With<Test1>().Build();
this.filter = this.world.Filter.With<IntTest1>().Build();

this.buffer = new Entity[Count];
for (var i = 0; i < Count; i++) {
this.buffer[i] = this.world.CreateEntity();
this.test1.Set(this.buffer[i], new Test1());
this.intTest1.Set(this.buffer[i], new IntTest1());
}

this.world.Commit();
}

// [Benchmark]
public void SetRemoveComponentArraySingle() {
public void DataStash_SetRemoveComponentArraySingle() {
foreach (var entity in this.buffer) {
this.test2.Set(entity, new Test2());
this.intTest2.Set(entity, new IntTest2());
}

this.world.Commit();

foreach (var entity in this.buffer) {
this.test2.Remove(entity);
this.intTest2.Remove(entity);
}

this.world.Commit();
}

// [Benchmark]
public void TagStash_SetRemoveComponentArraySingle() {
foreach (var entity in this.buffer) {
this.tagTest2.Set(entity);
}

this.world.Commit();

foreach (var entity in this.buffer) {
this.tagTest2.Remove(entity);
}

this.world.Commit();
}

// [Benchmark]
public void DataStash_SetRemoveComponentFilterSingle() {
foreach (var entity in this.filter) {
this.intTest2.Set(entity, new IntTest2());
}

this.world.Commit();

foreach (var entity in this.filter) {
this.intTest2.Remove(entity);
}

this.world.Commit();
}

// [Benchmark]
public void TagStash_SetRemoveComponentFilterSingle() {
foreach (var entity in this.filter) {
this.tagTest2.Set(entity);
}

this.world.Commit();

foreach (var entity in this.filter) {
this.tagTest2.Remove(entity);
}

this.world.Commit();
}

// [Benchmark]
public void SetRemoveComponentFilterSingle() {
public void DataStash_SetRemoveComponentFilterDouble() {
foreach (var entity in this.filter) {
this.test2.Set(entity, new Test2());
this.intTest2.Set(entity, new IntTest2());
this.intTest3.Set(entity, new IntTest3());
}

this.world.Commit();

foreach (var entity in this.filter) {
this.test2.Remove(entity);
this.intTest2.Remove(entity);
this.intTest3.Remove(entity);
}

this.world.Commit();
}

// [Benchmark]
public void SetRemoveComponentFilterDouble() {
public void TagStash_SetRemoveComponentFilterDouble() {
foreach (var entity in this.filter) {
this.test2.Set(entity, new Test2());
this.test3.Set(entity, new Test3());
this.tagTest2.Set(entity);
this.tagTest3.Set(entity);
}

this.world.Commit();

foreach (var entity in this.filter) {
this.test2.Remove(entity);
this.test3.Remove(entity);
this.tagTest2.Remove(entity);
this.tagTest3.Remove(entity);
}

this.world.Commit();
Expand All @@ -92,9 +145,9 @@ public void SetRemoveComponentFilterDouble() {
// [Benchmark]
public void NewArchetypeFuckery() {
foreach (var entity in this.buffer) {
this.test2.Set(entity, new Test2());
this.intTest2.Set(entity, new IntTest2());
this.world.Commit();
this.test2.Remove(entity);
this.intTest2.Remove(entity);
this.world.Commit();
}
}
Expand Down
12 changes: 12 additions & 0 deletions Scellecs.Morpeh.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Layout", "Layout~\Layout.cs
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StaticGenerators", "StaticGenerators~\StaticGenerators.csproj", "{8DB198DD-4193-481E-9731-2F30DD80BB1C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SourceGenerators", "SourceGenerators~\SourceGenerators\SourceGenerators.csproj", "{56DC1B3D-AE43-4AC7-A995-D1D20058F2D1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SourceGenerators.Fiddle", "SourceGenerators~\SourceGenerators.Fiddle\SourceGenerators.Fiddle.csproj", "{A1662B81-EB19-427D-A269-6E8AE5F6849B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -36,5 +40,13 @@ Global
{8DB198DD-4193-481E-9731-2F30DD80BB1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8DB198DD-4193-481E-9731-2F30DD80BB1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8DB198DD-4193-481E-9731-2F30DD80BB1C}.Release|Any CPU.Build.0 = Release|Any CPU
{56DC1B3D-AE43-4AC7-A995-D1D20058F2D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{56DC1B3D-AE43-4AC7-A995-D1D20058F2D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{56DC1B3D-AE43-4AC7-A995-D1D20058F2D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{56DC1B3D-AE43-4AC7-A995-D1D20058F2D1}.Release|Any CPU.Build.0 = Release|Any CPU
{A1662B81-EB19-427D-A269-6E8AE5F6849B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A1662B81-EB19-427D-A269-6E8AE5F6849B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A1662B81-EB19-427D-A269-6E8AE5F6849B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A1662B81-EB19-427D-A269-6E8AE5F6849B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
9 changes: 6 additions & 3 deletions Scellecs.Morpeh/Core/Aspects/Aspect.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
namespace Scellecs.Morpeh {
using System;

#if !MORPEH_SUPPRESS_OBSOLETE
[Obsolete("Will be removed in future versions")]
#endif
public interface IAspect {
Entity Entity { get; set; }

void OnGetAspectFactory(World world);
}

#if !MORPEH_SUPPRESS_OBSOLETE
[Obsolete("Will be removed in future versions")]
#endif
public interface IBoxedAspectFactory {
Type AspectType { get; }

IAspect ValueBoxed { get; set; }
}

#if !MORPEH_SUPPRESS_OBSOLETE
[Obsolete("Will be removed in future versions")]
#endif
public struct AspectFactory<T> : IBoxedAspectFactory where T : struct, IAspect {
internal T value;

Expand Down
2 changes: 2 additions & 0 deletions Scellecs.Morpeh/Core/Aspects/AspectExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System;

namespace Scellecs.Morpeh {
#if !MORPEH_SUPPRESS_OBSOLETE
[Obsolete("Will be removed in future versions")]
#endif
public static class AspectExtensions {
public static T Get<T>(this ref AspectFactory<T> aspectFactory, Entity entity) where T : struct, IAspect {
var aspect = aspectFactory.value;
Expand Down
3 changes: 0 additions & 3 deletions Scellecs.Morpeh/Core/Collections/FastList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,13 @@ public FastList() {
this.capacity = 4;
this.data = new T[this.capacity];
this.length = 0;
this.comparer = EqualityComparer<T>.Default;
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public FastList(int capacity) {
this.capacity = HashHelpers.GetCapacitySmall(capacity) + 1;
this.data = new T[this.capacity];
this.length = 0;

this.comparer = EqualityComparer<T>.Default;
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down
2 changes: 2 additions & 0 deletions Scellecs.Morpeh/Core/Collections/FastListExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ public static void AddRange<T>(this FastList<T> list, FastList<T> other) {
/// <returns>The zero-based index of the first occurrence of the element; or -1 if not found.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int IndexOf<T>(this FastList<T> list, T value) {
list.comparer ??= EqualityComparer<T>.Default;

for (int i = 0, length = list.length; i < length; i++) {
if (list.comparer.Equals(value, list.data[i])) {
return i;
Expand Down
10 changes: 1 addition & 9 deletions Scellecs.Morpeh/Core/Components/ComponentId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ public static bool TryGet(int typeId, out Type type) {
public static class ComponentId<T> where T : struct, IComponent {
internal static TypeInfo info;
internal static bool initialized;

public static int StashSize;

static ComponentId() {
Warmup();
Expand All @@ -59,19 +57,13 @@ public static void Warmup() {
}

initialized = true;

StashSize = StashConstants.DEFAULT_COMPONENTS_CAPACITY;


var typeId = ComponentsCounter.Increment();
var typeHash = Math.Abs(7_777_777_777_777_777_773L * typeId);

info = new TypeInfo(new TypeHash(typeHash), typeId);

ComponentId.Add(typeof(T), info);

#if MORPEH_GENERATE_ALL_EXTENDED_IDS
ExtendedComponentId.Generate<T>();
#endif
}
}
}
Loading