Comments (3)
Just ported the Sample to FNA which is more NativeAOT friendly and it runs fine with some tweaks [removed the managed Texture2D
field from the Sprite struct
from arch.
- the compiler cannot predict the bytes size in memory, this is done during the runtime. So we could have a waste of resources here
Using the generic overloads actually registers components during "compile time" ( or atleast the first time they are being invoked ). Thats why i added API like: world.Create<Position, Velocity,...>(...);
. This is already as efficient as it can get, since the compile time static Component<T>
is being used :)
Using the type based approach however will determine during runtime, but theres no way around it... since types are used.
- accessing to a component might be slower when using the
Unsafe.As
API for the reason above (things get done runtime side)
It depends, receiving an array from a Chunk
is actually a O(1) operation. A internal lookup array is being used (chunk.ComponentIdToArrayIndex
) to get the index of the component array which is the most efficient way... Only a direct field acess is faster.
- the app cannot use the nativeaot optimizations (disable reflection) if the users wants (need to try out tbh)
As far as i know,Array.CreateInstance
is not being stripped out. So it should actually work, i think i also already ran it once in nativeaot. However we should probably retry this to see if it still works.
I was wondering if it's worth to replace the managed
Array.CreateInstance
with an opaque unmanaged pointers pool.
The problem with umanaged memory is that its way more restrictive. With unmanaged memory, we could not use managed structs as components anymore public struct Texture{ Texture2D... }
and therefore its usage with monogame, godot or unity would be a very very bad experience. I actually had a branch where i used a combination of unmanaged memory and managed arrays to simulate this. However according to benchmarks it was not faster, it performed the same.
from arch.
Just ported the Sample to FNA which is more NativeAOT friendly and it runs fine with some tweaks [removed the managed
Texture2D
field from theSprite struct
Thats great to hear :D
from arch.
Related Issues (20)
- Unity support HOT 13
- Integrate preprocessor into event call methods for better code readability
- Entity relations
- Duplicated results in query HOT 16
- `Debug.Assert` for operations on entities and dead entities. HOT 2
- Refactor `World.Add<T>` and `Archetype` to capsulate Edge creation
- Arch.Extended `ParallelQuery`?
- Alternative to Dictionary<T, int> HOT 5
- Moving Entity causes messed up `World.EntityInfo` and zombie references HOT 1
- `in Entity` vs `ref Entity` in `Query()` overloads HOT 2
- Replace Dictionary EntityInfo with a simple array. HOT 8
- Non-github contact details/discussion area? HOT 3
- Possible reference issue? HOT 5
- macOS arm64 support HOT 3
- `WithNone<Component>()` doesn't remove those entities from the query HOT 5
- Add `World.Create(object[])` HOT 2
- How can I make a sorted query ? HOT 2
- Entity creation and add of components while iterating a query HOT 14
- Add instance receivers for `EventBus`
- New QueryDescription magically erases entities of unrelated types HOT 15
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 arch.