TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

FlexBuffers

325 pointsby excerionsfortealmost 5 years ago

12 comments

uluyolalmost 5 years ago
So here&#x27;s how I think this fits into all the other different types of data serialization:<p>Schema-ful, copying: Protobuf, Thrift, plenty more<p>Schema-ful, zero-copy: Cap&#x27;n&#x27;proto, Flatbuffers<p>Schema-less, copying: Json (binary and other variants included), XML<p>Schema-less, zero-copy: Flexbuffers (Any others? This seems new to me)
评论 #23590606 未加载
评论 #23589241 未加载
评论 #23589152 未加载
评论 #23590080 未加载
评论 #23589528 未加载
评论 #23590497 未加载
评论 #23588876 未加载
评论 #23590910 未加载
评论 #23589037 未加载
评论 #23591067 未加载
评论 #23589466 未加载
评论 #23591542 未加载
评论 #23589204 未加载
评论 #23588985 未加载
评论 #23592502 未加载
评论 #23597569 未加载
评论 #23591876 未加载
评论 #23591362 未加载
评论 #23588882 未加载
评论 #23592089 未加载
8organicbitsalmost 5 years ago
&gt; if you supply a buffer that actually contains a float, or a string with numbers in it, it will convert it for you on the fly as well, or return 0 if it can&#x27;t. If instead you actually want to know what is inside the buffer before you access it, you can call root.GetType() or root.IsInt() etc.<p>I&#x27;ve started to prefer functions that are explicit about their error cases and have interfaces that make it obvious about what errors you&#x27;d want to handle. Unexpectedly getting a zero when you get garbage data may cause issues.<p>Thinking about it, zero is often used as a success code: ERROR_SUCCESS is 0x0 on Windows. So garbage in, ERROR_SUCCESS out??<p>Something like:<p><pre><code> value, err = root.AsInt64(); </code></pre> makes it clear you have an error path. You can still ignore `err`, like when you are moving fast and breaking things or it&#x27;s somehow certain to always succeed, but it&#x27;s clear that there&#x27;s an unhandled error path.
评论 #23589518 未加载
评论 #23589325 未加载
评论 #23589235 未加载
sillysaurusxalmost 5 years ago
<a href="https:&#x2F;&#x2F;google.github.io&#x2F;flatbuffers&#x2F;flatbuffers_white_paper.html" rel="nofollow">https:&#x2F;&#x2F;google.github.io&#x2F;flatbuffers&#x2F;flatbuffers_white_paper...</a> has the “why”, if anyone is curious.
Aardappelalmost 5 years ago
I made this thing! AMA :)
评论 #23589575 未加载
评论 #23589708 未加载
评论 #23591749 未加载
评论 #23590445 未加载
secondcomingalmost 5 years ago
I&#x27;m looking to replace our current Boost.Serialization code with something else. I have the following requirements:<p>- serialisation cannot be intrusive (i.e. I don&#x27;t want a class definition to be generated from a schema file)<p>- zero copy<p>- some sort of versioning so any accidental message version mismatch between sender and receiver doesn&#x27;t cause a crash &#x2F; undefined behviour.<p>- many language support<p>Protobufs are intrusive, so that rules them out. JSON is just too verbose and slow. MessagePack looked like the most promising path to pursue at the moment. Flatbuffers look quite similar.
评论 #23592341 未加载
ccktlmazeltovalmost 5 years ago
there&#x27;s a lot of C++ around this FlexBuffer thing so I&#x27;m not sure how relevant it is outside of C++. Any idea?
评论 #23588923 未加载
评论 #23589508 未加载
评论 #23589923 未加载
评论 #23589537 未加载
评论 #23589272 未加载
评论 #23588987 未加载
评论 #23588948 未加载
person_of_coloralmost 5 years ago
What does zero-copy mean in this context?
评论 #23589451 未加载
je42almost 5 years ago
I wonder how it compares to messagepack&#x27;s zero copy serializer: <a href="https:&#x2F;&#x2F;blog.treasuredata.com&#x2F;blog&#x2F;2011&#x2F;11&#x2F;21&#x2F;messagepack-the-missing-serializer&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.treasuredata.com&#x2F;blog&#x2F;2011&#x2F;11&#x2F;21&#x2F;messagepack-th...</a> ?
m0zgalmost 5 years ago
I wish Google open sourced RecordIO instead (or in addition). People reinvent this particular bicycle, poorly, pretty much in every project where engineers are smart enough to introduce a _structured_ application log.
评论 #23589585 未加载
评论 #23591996 未加载
86J8oyZvalmost 5 years ago
So, is this basically Android&#x27;s Bundle semantics made standard and cross-platform? Are there differences implementation-wise?
armitronalmost 5 years ago
I&#x27;d rather use MessagePack. Clean, simple, small.
评论 #23589330 未加载
vbezhenaralmost 5 years ago
Java example is very weird.