MemoizR 0.0.4-rc2

This is a prerelease version of MemoizR.
There is a newer version of this package available.
See the version list below for details.
dotnet add package MemoizR --version 0.0.4-rc2
NuGet\Install-Package MemoizR -Version 0.0.4-rc2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MemoizR" Version="0.0.4-rc2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MemoizR --version 0.0.4-rc2
#r "nuget: MemoizR, 0.0.4-rc2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MemoizR as a Cake Addin
#addin nuget:?package=MemoizR&version=0.0.4-rc2&prerelease

// Install MemoizR as a Cake Tool
#tool nuget:?package=MemoizR&version=0.0.4-rc2&prerelease

MemoizR: Simplifying Concurrency in .NET

MemoizR is a powerful concurrency model implementation designed to simplify and enhance state synchronization across multiple threads in .NET applications. It offers a performant and thread-safe approach to managing concurrency challenges, making it an excellent choice for various scenarios.

Key Advantages

  • Simplicity and Intuitiveness: MemoizR aims to provide a straightforward and intuitive way to handle concurrency, avoiding the complexities often associated with async/await patterns in C#. It offers a more natural approach to managing asynchronous tasks and multithreading.

  • Scalability: This concurrency model has the potential for expansion into distributed setups, similar to the actor model. It can help you build scalable and distributed systems with ease.

  • Maintainable Code: MemoizR is designed to ensure the maintainability of your code, especially when dealing with challenging concurrent state synchronization problems in multi-threaded environments.

  • Performance Optimization: Even for simple use cases, MemoizR can optimize performance in scenarios where there are more reads than writes (thanks to memoization) or more writes than reads (using lazy evaluation).

Dynamic Lazy Memoization

With MemoizR, you can create a dependency graph that performs dynamic lazy memoization. This means that values are calculated only when needed and only if they haven't been calculated before (memoization). It also ensures efficient resource utilization and reduces unnecessary calculations (lazy). This implementation draws inspiration from the concepts found in reactively (https://github.com/modderme123/reactively)

Inspiration and Benefits

MemoizR draws inspiration from various sources, including the concept of dynamic lazy memoization, VHDL for synchronization, and ReactiveX. Here are some key benefits of using MemoizR:

  • Dependency Tracking: MemoizR automatically tracks dependencies between functions and methods, eliminating the need for manual source listing. This ensures that calculations are triggered only when necessary.

  • Optimization: MemoizR includes intelligent optimization algorithms. Functions are executed only if required and only once, even in complex dependency networks. This reduces unnecessary computations and enhances efficiency.

Execution Model: Push-Pull Hybrid

MemoizR utilizes a hybrid push-pull execution model. It pushes notifications of changes down the graph and executes MemoizR elements lazily on demand as they are pulled from the leaves. This approach combines the simplicity of pull systems with the execution efficiency of push systems.

Example

Here's a simple example of using MemoizR:

var f = new MemoFactory();
var v1 = f.CreateSignal(1, "v1");
var m1 = f.CreateMemoizR(() => v1.Get(), "m1");
var m2 = f.CreateMemoizR(() => v1.Get() * 2, "m2");
var m3 = f.CreateMemoizR(() => m1.Get() + m2.Get(), "m3");

// Get Values
m3.Get(); // Calculates m1 + 2 * m1 => (1 + 2 * 1) = 3

// Change
v1.Set(2); // Setting v1 does not trigger the evaluation of the graph
m3.Get(); // Calculates m1 + 2 * m1 => (1 + 2 * 2) = 6
m3.Get(); // No operation, result remains 6

v1.Set(3); // Setting v1 does not trigger the evaluation of the graph
v1.Set(2); // Setting v1 does not trigger the evaluation of the graph
m3.Get(); // No operation, result remains 6 (because the last time the graph was evaluated, v1 was already 2)

MemoizR can also handle scenarios where the graph is not stable at runtime, making it adaptable to changing dependencies.

var m3 = f.CreateMemoizR(() => v1.Get() ? m1.Get() : m2.Get());

Get Started with MemoizR

Start using MemoizR to simplify and optimize concurrency management in your .NET applications. Enjoy a cleaner, and more efficient approach to handling concurrency challenges.

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net7.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on MemoizR:

Package Downloads
MemoizR.Reactive

Package Description

MemoizR.StructuredConcurrency

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.1.3 46 5/7/2024
0.1.2 78 5/6/2024
0.1.1 63 5/1/2024
0.1.1-rc.11 43 4/29/2024
0.1.1-rc.10 46 4/23/2024
0.1.1-rc.9 40 4/18/2024
0.1.1-rc.8 53 4/13/2024
0.1.1-rc.7 43 4/11/2024
0.1.1-rc.6 44 4/10/2024
0.1.1-rc.5 45 4/4/2024
0.1.1-rc.4 44 4/1/2024
0.1.1-rc.3 54 3/24/2024
0.1.1-rc.2 52 2/17/2024
0.1.1-rc.1 121 1/4/2024
0.1.0-rc9 168 11/6/2023
0.1.0-rc8 121 10/26/2023
0.1.0-rc7 107 10/24/2023
0.1.0-rc6 128 10/21/2023
0.1.0-rc5 96 10/19/2023
0.1.0-rc4 112 10/14/2023
0.1.0-rc3 110 10/13/2023
0.1.0-rc2 103 10/11/2023
0.1.0-rc10 88 11/12/2023
0.1.0-rc1 102 10/10/2023
0.1.0-rc.11 61 1/4/2024
0.1.0-alpha2 119 10/6/2023
0.1.0-alpha1 93 10/6/2023
0.0.4-rc4 98 9/24/2023
0.0.4-rc3 93 9/23/2023
0.0.4-rc2 94 9/23/2023
0.0.4-rc1 92 9/22/2023
0.0.4-beta1 92 9/21/2023
0.0.4-alpha1 92 9/19/2023
0.0.3-beta-1 89 9/15/2023
0.0.2-rc4 83 8/30/2023
0.0.2-rc3 86 8/30/2023
0.0.2-rc2 87 8/30/2023
0.0.2-rc1 89 8/30/2023
0.0.2-beta2 92 8/30/2023
0.0.2-beta1 99 8/29/2023
0.0.1-beta1 88 8/28/2023
0.0.1-alpha2 95 8/28/2023
0.0.1-alpha1 89 8/27/2023