-
-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mechanism to support different offset (uoffset_t) size per table #179
Comments
Thanks for the thoughtful comments. This is something I'd love to see happen, but the line for FlatSharp right now is not doing anything to cause binary incompatibility with the canonical library. So the starting point for this needs to be a proposal in the official FlatBuffer repo. If you don't get traction there, then I think it's worth considering if there are sane ways FlatSharp can do extensions such that people can't mix standard and extension formats. One idea for this is a set of directive statements at the top of the file:
Ignoring the issue of imports, the thing I like about this is that it will cause a hard break with |
@aardappel wants to do it for FlatBuffers2; From google/flatbuffers#5875 (comment)
There's plenty of support, but not immediate concern. I'll create an issue for it if I can't find relevant discussion in the issue regarding specifying offset size (google/flatbuffers#5471). Yes, a parser-breaking extension to the FBS grammar would be a good idea to break unintentional apparent compatibility. I'd propose something that would be more possible for other implementations to generically support.
In a compiler that is attempting to support directives generically;
In FlatSharp if OffsetSize is unsupported;
In a compiler that is not attempting support;
A word other than directive may be appropriate, maybe something implying more requirement than option. |
I'm interested to see if the FlatBuffers2 proposal has any real traction or is just a wish list. Thanks for asking. I read it over a year ago and thought "that sounds neat!", and I still think that! It really would be a meaningful improvement to the format in a lot of ways. With respect to FlatSharp, implementing "mixed-mode" offset sizes is going to be hard. This is due to implementation details in FlatSharp where it wants to write a single method for each CLR Type, so if there is a method to serialize |
A wish list. |
Appreciate the response, @aardappel! |
@TYoungSL, I'm really of two minds about this. The first half says that large buffers would be useful, and adding them in a non-dangerous (ie, incompatible with The other half says that at the end of the day, FlatSharp is an implementation of FlatBuffers, 2GB limit and all. So while I can toe the line of the FlatBuffers format with various features (type facades, indexed vectors, etc), binary compatibility and correctness of the format are king, because much of the usefulness of the project derives from those two things. The parts that concern me most are:
|
If ultimately we have data structures that exceed 1-2GB, perhaps FlatBuffers was a poor choice. |
Most serialization formats are going to be poor choices if your goal is 100GB! Protobuf has a hard limit of 2GB. The only one I know of that supports 2^64 is Cap'n Proto, but I've not personally used it or the C# implementation. Based on my admittedly limited knowledge of your problem space, I think you have a few viable paths forward, but they all involve you writing some code.
|
Cap'n Proto's C# implementations leave something to be desired. |
Based on the comments in google/flatbuffers#5471, it seems like 64 bit mode might have a future sooner than the FlatBuffers2 proposal. If that comes to pass, then I'll definitely support it in FlatSharp. |
To clarify, I will do my best to support it. There are still some limitations in .NET around int32 that need to be thought through. For example, |
Yeah interested to see what shakes out. |
Per my #158 (comment) leading to @aardappel's plans for extending FlatBuffers to be 64-bit capable and/or creating FlatBuffers2, an attribute per table to change the encoding to a non-standard offset size may be a useful respite until official action is taken to provide support.
Of course such an implementation would not be expected to be binary compatible with other implementations, but keeping it simple might allow it to be compatible with future spec.
An implementation of variable sized ints is not meaningfully useful for the additional code required at this time, but they could also be done in a similar fashion.
They were discussed as a proposal for FlatBuffers2. They are a flexible alternative solution to achieve different offset sizing, but the additional code may not be necessary to achieve the same goals and is unlikely to provide any real world benefits over explicitly specified per-table offset sizing.
The text was updated successfully, but these errors were encountered: