GithubHelp home page GithubHelp logo

ada_buffered_streams's Introduction

Ada buffered streams

A personal WIP project meant to hopefully improve the performance of stream-based communication in other projects. Buffered writing and reading is provided, with reading handled in two different ways depending on use case.

The root type is declared as abstract inside buffered_streams.ads and provides the implementation of buffered writing that applies to all descendant types. Buffered writing works by directing all calls to Write to an internal buffer, then sending the buffer's contents across the stream all at once when it's completely filled, or whenever the Flush primitive is explicitly called.

The first implementation of buffered reading is provided by the subtype Agnostic_Buffer_Type inside the package buffered_streams-agnostic_buffer.ads. This type works much like a regular stream, in which any data type can be read from the stream at any time. Buffering functionality works by calling the Prefill primitive and specifying the size of the type that will be read next. Calls to Prefill are currently always expected to be followed by calls to Read. The way in which buffering works via this type is planned to change in the future.

The second implementation of buffered reading is provided by the subtype Unique_Buffer_Type inside the package buffered_streams-unique_buffer.ads. This type works differently than traditional streams, as indicated by its name, it is meant to be used to only read a single data type from the stream, like characters/strings for example, hence why the package is generic. Through this restriction, it is able to offer the ability to read until a certain delimiter is encountered in the buffer via the Read_Until primitive, returning all data that was read up until that point on Ada's secondary stack. Though in some cases you may need to explicitly allocate on the heap when very large amounts of data are being dealt with.

ada_buffered_streams's People

Watchers

 avatar

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.