An open API service indexing awesome lists of open source software.

https://github.com/sciml/resettablestacks.jl

A stack implementation with a reset! function which avoids garbage collection for scientific machine learning (SciML)
https://github.com/sciml/resettablestacks.jl

data-structures scientific-machine-learning sciml

Last synced: about 1 month ago
JSON representation

A stack implementation with a reset! function which avoids garbage collection for scientific machine learning (SciML)

Awesome Lists containing this project

README

          

# ResettableStacks

[![Build Status](https://github.com/SciML/ResettableStacks.jl/workflows/CI/badge.svg)](https://github.com/SciML/ResettableStacks.jl/actions?query=workflow%3ACI)

[![ResettableStacks](http://pkg.julialang.org/badges/ResettableStacks_0.5.svg)](http://pkg.julialang.org/?pkg=ResettableStacks)
[![ResettableStacks](http://pkg.julialang.org/badges/ResettableStacks_0.6.svg)](http://pkg.julialang.org/?pkg=ResettableStacks)

A ResettableStack is a stack implementation which has a `reset!` function which
will "reset" the stack, allowing it to write over its previous data. This
allows you to reset the stack while avoiding garbage collection which can greatly
improve performance in certain use cases. Every `FULL_RESET_COUNT` resets, it
does a full reset, which is useful if the stack got very large for some reason
and it no longer needs to be that large (while minimizing garbage control costs).

## Installation

To install the package, simply use:

```julia
Pkg.add("ResettableStacks")
using ResettableStacks
```

For the latest version, checkout master via:

```julia
Pkg.checkout("ResettableStacks")
```

## Usage

```julia
using ResettableStacks
S = ResettableStack{}(Tuple{Float64, Float64, Float64})

push!(S, (0.5, 0.4, 0.3))
push!(S, (0.5, 0.4, 0.4))
reset!(S)
push!(S, (0.5, 0.4, 0.3))
tup = pop!(S)
```