jamescourtney / FlatSharp

Fast, idiomatic C# implementation of Flatbuffers
Apache License 2.0
497 stars 50 forks source link

Experiment: IVector for fs_vector, making use of FlatSharp.Unsafe #205

Closed TYoungSL closed 2 years ago

TYoungSL commented 3 years ago

This is just an experiment, it's probably not a good idea.

Implement IVector, a Memory and IList work-alike.

Extend FlatBufferVector to implement IVector.

Add unsafe creation of FlatBufferVector to FlatSharp.Unsafe.

Has post-generation compile time warnings when FlatSharp.Unsafe is required.

Probably has all sorts of problems.

Gives direct access to backing memory for struct vectors, as has been already done elsewhere.

codecov[bot] commented 3 years ago

Codecov Report

Merging #205 (7dc1e5d) into master (8f87963) will decrease coverage by 0.99%. The diff coverage is 53.36%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #205      +/-   ##
==========================================
- Coverage   94.71%   93.71%   -1.00%     
==========================================
  Files         103      105       +2     
  Lines        7547     7734     +187     
  Branches      661      671      +10     
==========================================
+ Hits         7148     7248     +100     
- Misses        300      385      +85     
- Partials       99      101       +2     
Impacted Files Coverage Δ
src/FlatSharp.Runtime/FlatBufferVector.cs 78.07% <8.33%> (-15.62%) :arrow_down:
src/FlatSharp.Unsafe/FlatBufferVector.cs 35.41% <35.41%> (ø)
...arp/TypeModel/Vectors/FlatBufferVectorTypeModel.cs 85.36% <85.36%> (ø)
...atSharp.Compiler/TypeDefinitions/PropertyWriter.cs 93.28% <100.00%> (+0.08%) :arrow_up:
...arp.Compiler/TypeDefinitions/RootNodeDefinition.cs 100.00% <100.00%> (ø)
...atSharp/Serialization/RoslynSerializerGenerator.cs 99.53% <100.00%> (+0.02%) :arrow_up:
.../FlatSharp/TypeModel/FlatSharpTypeModelProvider.cs 100.00% <100.00%> (ø)
...FlatSharp/TypeModel/Vectors/ListVectorTypeModel.cs 95.16% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 8f87963...7dc1e5d. Read the comment docs.

jamescourtney commented 3 years ago

I'm taking a few days off from FlatSharp, but I'll take a look at this soon. Thanks for the ideas!