GithubHelp home page GithubHelp logo

Comments (3)

donmendelson avatar donmendelson commented on June 15, 2024

The way to specify word alignment is by specifying the offset attribute of a field or--starting with RC4--on an element within a composite Type. See issue #11, which has been approved by the working group.

You should be able to specify offset on blocklength in the message header as follows:

<type name="blockLength" primitiveType="uint16" offset="2"/>

The offset attribute has an advantage of supporting precalculated positions for encoders and decoders. However, it still requires humans to plan the alignment scheme. I can imagine an alternative that lets the computer do the computation by simply specifying byte alignment (2, 4, or 8 bytes) and letting a tool calculate the offsets. This would be applicable to blockType in the XML schema so it would apply to message root and repeating group entries and also to composite types.

from fix-simple-binary-encoding.

seh4nc avatar seh4nc commented on June 15, 2024

Hi Don, thanks for the response.

I was aware of the ability to specify offsets manually, but I was trying to design a single schema that could generate aligned fields relative to the start of the packet, regardless of whether we were "framing" the SBE with SOFH or not.

I've decided this was an unnecessary exercise. Instead, when I know my incoming packets have a 6-byte SOFH, and I want the SBE content following the SOFH to be word-aligned, then I can arrange for the byte array passed to the socket read function to begin two bytes higher than a word boundary. In the case of Java / Netty, this can be accomplished with a custom RecvByteBufAllocator (at least for the first frame that is waiting to be read from the NIC; if multiple frames are read then only the first one benefits from the alignment). Some benchmarking is needed to determine if any of this makes a difference anyway for our particular protocol and access patterns.

In conclusion, I've switched back to the "standard" 8-byte SBE Message Header (without any "blockOffset" addition).

from fix-simple-binary-encoding.

donmendelson avatar donmendelson commented on June 15, 2024

@seh4nc as always, our decisions should be guided by measured performance. Let us know about any interesting results.

from fix-simple-binary-encoding.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.