Comments (5)
Here is the benchmark source I've tested
Results:
BenchmarkDotNet=v0.13.2, OS=macOS Monterey 12.3 (21E230) [Darwin 21.4.0]
Apple M1 Pro, 1 CPU, 10 logical and 10 physical cores
.NET SDK=7.0.101
[Host] : .NET 6.0.2 (6.0.222.6406), Arm64 RyuJIT AdvSIMD
DefaultJob : .NET 6.0.2 (6.0.222.6406), Arm64 RyuJIT AdvSIMD
Method | Mean | Error | StdDev | Ratio | Allocated | Alloc Ratio |
---|---|---|---|---|---|---|
PointerAccess | 57.97 ms | 0.772 ms | 0.722 ms | 0.46 | 154 B | 0.23 |
NBFixed | 59.77 ms | 0.258 ms | 0.215 ms | 0.47 | 75 B | 0.11 |
NBWithSize | 240.70 ms | 0.737 ms | 0.689 ms | 1.90 | 893 B | 1.33 |
NBWithSentinel | 127.20 ms | 0.262 ms | 0.233 ms | 1.00 | 168 B | 0.25 |
NBWithSentinelAndSize | 126.93 ms | 0.148 ms | 0.123 ms | 1.00 | 670 B | 1.00 |
Weirdly, removing using
block but not replacing SIZE
makes it even slower. I think it is related to static constructor for SIZE
while the code got inlined.
from svelto.ecs.
I've added benchmark result for .NET 7 and Mono to the link, and it seems accessing with pointer is much performant for those. I think using T*
instead of Unsafe
APIs should be considered alongside.
from svelto.ecs.
I am pretty sure (confirmed with sharplab.io) that in release compilation the using will not generate a try catch if it's empty, in any case atm that line can be commented out. However the static field killed me, I have to think a lot about it as I use this everywhere in the code. Why is your benchmarking alocating at all?
from svelto.ecs.
that in release compilation the using will not generate a try catch if it's empty
Main issue would be that using
prevents inlining. I've tested with this SharpLab, and if you see the assembly it prevents inlining to CallWithUsing
while method WithUsing
does not contain try-finally.
Why is your benchmarking alocating at all?
It only happens if I put a very big number for Count
for some reason. It happens on irrelevant benchmarks as well. I think it's MemoryDiagnoser
issue.
from svelto.ecs.
according my profiing Unsafe.As is as fast as using T*
from svelto.ecs.
Related Issues (20)
- Multiple FindGroups Issue HOT 3
- NuGet package? HOT 3
- using UnityEngine Namespace
- Using with MonoGame HOT 3
- Svelto.ECS on OpenUPM HOT 65
- Any chance something like this might work with UnrealCLR? HOT 1
- Does Svelto work without Unity? Any gotchas to keep in mind? HOT 2
- Update to 3.1.0 bug on Extension UECS HOT 7
- error CS0246: The type or namespace name 'ConditionalAttribute' could not be found HOT 1
- nuget package is compiled as debug HOT 18
- is there network example? HOT 1
- ICompositionRoot.OnContextDestroyed called twice in Example2-Unity Hybrid-Survival HOT 2
- Question about why Svelto's log is default StackTraceLogType.None HOT 2
- Use `Enum.GetNames` to replace the need of a struct for `ISequenceOrder` HOT 2
- `NativeEntityFactory` cannnot create ExtendibleEntityDescriptors HOT 2
- `SortedJobifiedEnginesGroup` does not implement `IJobifiedEngine` HOT 1
- GroupHashMap throws exception when serializing entity in group using bytemask HOT 2
- QueryEntities Unlimited Components HOT 3
- test discussion
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from svelto.ecs.