simple-binary-encoding | Simple Binary Encoding - High Performance Message

 by   real-logic Java Version: 1.28.1 License: Apache-2.0

kandi X-RAY | simple-binary-encoding Summary

kandi X-RAY | simple-binary-encoding Summary

simple-binary-encoding is a Java library. simple-binary-encoding has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has medium support. You can download it from GitHub, Maven.

[Code Quality: Java] [SBE] is an OSI layer 6 presentation for encoding and decoding binary application messages for low-latency financial applications. This repository contains the reference implementations in Java, C++, Golang, and C#. More details on the design and usage of SBE can be found on the [Wiki] An XSD for SBE specs can be found [here] Please address questions about the specification to the [SBE FIX community] For the latest version information and changes see the [Change Log] with downloads at [Maven Central] The Java and C++ SBE implementations work very efficiently with the [Aeron] messaging system for low-latency and high-throughput communications. The Java SBE implementation has a dependency on [Agrona] for its buffer implementations. Commercial support is available from [sales@real-logic.co.uk] mailto:sales@real-logic.co.uk?subject=SBE).
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              simple-binary-encoding has a medium active ecosystem.
              It has 2817 star(s) with 478 fork(s). There are 204 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 20 open issues and 597 have been closed. On average issues are closed in 85 days. There are 1 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of simple-binary-encoding is 1.28.1

            kandi-Quality Quality

              simple-binary-encoding has 0 bugs and 0 code smells.

            kandi-Security Security

              simple-binary-encoding has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              simple-binary-encoding code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              simple-binary-encoding is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              simple-binary-encoding releases are available to install and integrate.
              Deployable package is available in Maven.
              Build file is available. You can build the component from source.
              Installation instructions, examples and code snippets are available.
              simple-binary-encoding saves you 17738 person hours of effort in developing the same functionality from scratch.
              It has 36394 lines of code, 1824 functions and 242 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed simple-binary-encoding and discovered the below as its top functions. This is intended to give you an instant insight into simple-binary-encoding implemented functionality, and help decide if they suit your requirements.
            • Creates the encode method .
            • Generate code for group header functions .
            • Generate code to decode primitive arrays .
            • Generate variable data .
            • Append the encoding as a string .
            • Appends the contents of the given buffer as a JSON string .
            • Process a type node .
            • Decodes groups .
            • Puts the given primitive value into the given buffer .
            • Generate choices .
            Get all kandi verified functions for this library.

            simple-binary-encoding Key Features

            No Key Features are available at this moment for simple-binary-encoding.

            simple-binary-encoding Examples and Code Snippets

            No Code Snippets are available at this moment for simple-binary-encoding.

            Community Discussions

            QUESTION

            Does aligning memory on particular address boundaries in C/C++ still improve x86 performance?
            Asked 2019-Jan-07 at 03:24

            Many guides to low latency development discuss aligning memory allocations on particular address boundaries:

            https://github.com/real-logic/simple-binary-encoding/wiki/Design-Principles#word-aligned-access

            http://www.alexonlinux.com/aligned-vs-unaligned-memory-access

            However, the second link is from 2008. Does aligning memory on address boundaries still provide a performance improvement on Intel CPUs in 2019? I thought Intel CPUs no-longer incur a latency penalty accessing unaligned addresses? If not, under what circumstances should this be done? Should I align every stack variable? Class member variable?

            Does anybody have any examples where they have found a significant performance improvement from aligning memory?

            ...

            ANSWER

            Answered 2019-Jan-07 at 03:24

            The penalties are usually small, but crossing a 4k page boundary on Intel CPUs before Skylake has a large penalty (~150 cycles). How can I accurately benchmark unaligned access speed on x86_64 has some details on the actual effects of crossing a cache-line boundary or a 4k boundary. (This applies even if the load / store is inside one 2M or 1G hugepage, because the hardware can't know that until after it's started the process of checking the TLB twice.) e.g in an array of double that was only 4-byte aligned, at a page boundary there'd be one double that was split evenly across two 4k pages. Same for every cache-line boundary.

            Regular cache-line splits that don't cross a 4k page cost ~6 extra cycles of latency on Intel (total of 11c on Skylake, vs. 4 or 5c for a normal L1d hit), and cost extra throughput (which can matter in code that normally sustains close to 2 loads per clock.)

            Misalignment without crossing a 64-byte cache-line boundary has zero penalty on Intel. On AMD, cache lines are still 64 bytes, but there are relevant boundaries within cache lines at 32 bytes and maybe 16 on some CPUs.

            Should I align every stack variable?

            No, the compiler already does that for you. x86-64 calling conventions maintain a 16-byte stack alignment so they can get any alignment up to that for free, including 8-byte int64_t and double arrays.

            Also remember that most local variables are kept in registers for most of the time they're getting heavy use. Unless a variable is volatile, or you compile without optimization, the value doesn't have to be stored / reloaded between accesses.

            The normal ABIs also require natural alignment (aligned to its size) for all the primitive types, so even inside structs and so on you will get alignment, and a single primitive type will never span a cache-line boundary. (exception: i386 System V only requires 4 byte alignment for int64_t and double. Outside of structs, the compiler will choose to give them more alignment, but inside structs it can't change the layout rules. So declare your structs in an order that puts the 8-byte members first, or at least laid out so they get 8-byte alignment. Maybe use alignas(8) on such struct members if you care about 32-bit code, if there aren't already any members that require that much alignment.)

            The x86-64 System V ABI (all non-Windows platforms) requires aligning arrays by 16 if they have automatic or static storage outside of a struct. maxalign_t is 16 on x86-64 SysV so malloc / new return 16-byte aligned memory for dynamic allocation. gcc targeting Windows also aligns stack arrays if it auto-vectorizes over them in that function.

            (If you cause undefined behaviour by violating the ABI's alignment requirements, it often doesn't make any performance different. It usually doesn't cause correctness problems x86, but it can lead to faults for SIMD type, and with auto-vectorization of scalar types. e.g. Why does unaligned access to mmap'ed memory sometimes segfault on AMD64?. So if you intentionally misalign data, make sure you don't access it with any pointer wider than char*. e.g. use memcpy(&tmp, buf, 8) with uint64_t tmp to do an unaligned load. gcc can autovectorize through that, IIRC.)

            You might sometimes want to alignas(32) or 64 for large arrays, if you compile with AVX or AVX512 enabled. For a SIMD loop over a big array (that doesn't fit in L2 or L1d cache), with AVX/AVX2 (32-byte vectors) there's usually near-zero effect from making sure it's aligned by 32 on Intel Haswell/Skylake. Memory bottlenecks in data coming from L3 or DRAM will give the core's load/store units and L1d cache time to do multiple accesses under the hood, even if every other load/store crosses a cache-line boundary.

            But with AVX512 on Skylake-server, there is a significant effect in practice for 64-byte alignment of arrays, even with arrays that are coming from L3 cache or maybe DRAM. I forget the details, it's been a while since I looked at an example, but maybe 10 to 15% even for a memory-bound loop? Every 64-byte vector load and store will cross a 64-byte cache line boundary if they aren't aligned.

            Depending on the loop, you can handle under-aligned inputs by doing a first maybe-unaligned vector, then looping over aligned vectors until the last aligned vector. Another possibly-overlapping vector that goes to the end of the array can handle the last few bytes. This works great for a copy-and-process loop where it's ok to re-copy and re-process the same elements in the overlap, but there are other techniques you can use for other cases, e.g. a scalar loop up to an alignment boundary, narrower vectors, or masking. If your compiler is auto-vectorizing, it's up to the compiler to choose. If you're manually vectorizing with intrinsics, you get to / have to choose. If arrays are normally aligned, it's a good idea to just use unaligned loads (which have no penalty if the pointers are aligned at runtime), and let the hardware handle the rare cases of unaligned inputs so you don't have any software overhead on aligned inputs.

            Source https://stackoverflow.com/questions/54049474

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install simple-binary-encoding

            Binaries and dependency information for Maven, Ivy, Gradle, and others can be found at [http://search.maven.org](http://search.maven.org/#search%7Cga%7C1%7Csbe).
            Build the project with [Gradle](http://gradle.org/) using this [build.gradle](https://github.com/real-logic/simple-binary-encoding/blob/master/build.gradle) file. Run the Java examples.
            Linux, Mac OS, and Windows only for the moment. See [FAQ](https://github.com/real-logic/simple-binary-encoding/wiki/Frequently-Asked-Questions). Windows builds have been tested with Visual Studio Express 12. For convenience, the cppbuild script does a full clean, build, and test of all targets as a Release build.
            First build using Gradle to generate the SBE jar and then use it to generate the golang code for testing. For convenience on Linux, a gnu Makefile is provided that runs some tests and contains some examples. Users of golang generated code should see the [user documentation](https://github.com/real-logic/simple-binary-encoding/wiki/Golang-User-Guide). Developers wishing to enhance the golang generator should see the [developer documentation](https://github.com/real-logic/simple-binary-encoding/blob/master/gocode/README.md).
            Users of CSharp generated code should see the [user documentation](https://github.com/real-logic/simple-binary-encoding/wiki/Csharp-User-Guide). Developers wishing to enhance the CSharp generator should see the [developer documentation](https://github.com/real-logic/simple-binary-encoding/blob/master/csharp/README.md).

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/real-logic/simple-binary-encoding.git

          • CLI

            gh repo clone real-logic/simple-binary-encoding

          • sshUrl

            git@github.com:real-logic/simple-binary-encoding.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Consider Popular Java Libraries

            CS-Notes

            by CyC2018

            JavaGuide

            by Snailclimb

            LeetCodeAnimation

            by MisterBooo

            spring-boot

            by spring-projects

            Try Top Libraries by real-logic

            aeron

            by real-logicJava

            agrona

            by real-logicJava

            artio

            by real-logicJava

            benchmarks

            by real-logicJava

            aeron-cookbook-code

            by real-logicJava