Giter Site home page Giter Site logo

framering's Introduction

FrameRing

FrameRing is a queue-of-queues designed for memory efficiency & locality. FrameRing can be used to create looping software which avoids memory allocations for temporary scratch vectors and supports memory locality even across multiple different vectors.

Overview

Frames created in the same FrameRing share the same backing memory, allowing for the creation of large amounts of temporary lists without needing a memory allocation each time. Many FrameRing operations are constant time, including creating and dropping frames, appending to the mutable frame, iterating over any frame, and random access into any frame.

FrameRing is able to reuse memory previously freed from dropping older frames for elements appended to new frames. Only the front frame (the mutable frame) is able to be appended to at any time, but elements from previous frames are able to be accessed until the frame itself is dropped, making the structure ideal for storing lists for use in computations which mimic map reduce operations.

Example

let mut ring = FramedRing::<i32, Pow2Capacity>::new();
let mut frame = ring.frame();
frame.push(1);
let (frame_ro, mut frame2) = frame.next();
// frame_ro now contains [1], but frame_ro is incapable of additional pushes
// However, frame2 is now able to be appended to.
frame2.push(2);
// frame_ro can be dropped whenever without requiring frame2 to be dropped
drop(frame_ro);
// ... while still maintaining the elements in frame2
frame2.as_ref().get(0) // Returns Some(2)

License

GPL v3 - see header at top of src/lib.rs.

Contributing

Feel free to submit any changes as a PR request, as long as the contribution is licensed under GPL v3 without any additional terms.

framering's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  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.