cysharp / structureofarraysgenerator Goto Github PK
View Code? Open in Web Editor NEWStructure of arrays source generator to make CPU Cache and SIMD friendly data structure for high-performance code in .NET and Unity.
License: MIT License
Structure of arrays source generator to make CPU Cache and SIMD friendly data structure for high-performance code in .NET and Unity.
License: MIT License
as an option
[MultiArray(typeof(Vector3), IndividualArrays = true)]
public readonly partial struct Vector3MultiArray
{
}
[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Auto)]
partial struct Vector3MultiArray : global::StructureOfArraysGenerator.IMultiArray<Vector3MultiArray>
{
- readonly byte[] __value;
+ readonly float[] __valueX;
+ readonly float[] __valueY;
+ readonly float[] __valueZ;
readonly int __length;
- readonly int __byteSize;
- readonly int __byteOffsetX;
- readonly int __byteOffsetY;
- readonly int __byteOffsetZ;
public int Length => __length;
- public Span<float> X => MemoryMarshal.CreateSpan(ref Unsafe.As<byte, float>(ref Unsafe.Add(ref GetArrayDataReference(__value), __byteOffsetX)), __length);
- public Span<float> Y => MemoryMarshal.CreateSpan(ref Unsafe.As<byte, float>(ref Unsafe.Add(ref GetArrayDataReference(__value), __byteOffsetY)), __length);
- public Span<float> Z => MemoryMarshal.CreateSpan(ref Unsafe.As<byte, float>(ref Unsafe.Add(ref GetArrayDataReference(__value), __byteOffsetZ)), __length);
+ public Span<float> X => __valueX;
+ public Span<float> Y => __valueY;
+ public Span<float> Z => __valueZ;
...
}
this will allow to have more than 2^(32-1)/sizeof(T)
elements in a single array.
It would be nice to emit the CopyTo(TMultiArray array) method in the TMultiArray type, so it will give flexibility of fast copy operation.
The ToArray
method creates a new array with possibly smaller length, and then calls CopyTo
, but the implementation copies based on the actual capacity size of the array list. This will often cause heap overflow.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.