Sharpify 2.4.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Sharpify --version 2.4.0                
NuGet\Install-Package Sharpify -Version 2.4.0                
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="Sharpify" Version="2.4.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Sharpify --version 2.4.0                
#r "nuget: Sharpify, 2.4.0"                
#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 Sharpify as a Cake Addin
#addin nuget:?package=Sharpify&version=2.4.0

// Install Sharpify as a Cake Tool
#tool nuget:?package=Sharpify&version=2.4.0                

CHANGELOG

v2.4.0

  • All derived types of PersistentDictionary now implement IDisposable interface.
  • Main concurrent processing methods are now ICollection<T>.ForAll() and ICollection<T>.ForAllAsync() from many, many benchmarks it became clear that for short duration tasks not involving heavy compute, it has by far the best compromise of speed and memory-allocation. If you use it with a non async function all the tasks will yield immediately and require virtually no allocations at all. Which is as good as ValueTask from benchmarks. This method has 2 overloads, one which accepts an IAsyncAction which enables users with long code and many captured variables to maintain a better structured codebase, and a Func alternative for quick and easy usage. The difference in memory allocation / execution time between time is nearly non-existent, this mainly for maintainability.
  • For heavier compute tasks, please revert to using Parallel.For or Parallel.ForEachAsync and their overloads, they are excellent in load balancing.
  • Due to the changes above, all other concurrent processing methods, such as ForEachAsync, InvokeAsync and all the related functionality from the Concurrent class have been removed. AsAsyncLocal entry is also removed, and users will be able to access the new ForAll and ForAllAsync methods directly from the ICollection<T> interface static extensions.
  • ForAll and ForAllAsync methods have identical parameters, the only difference is that the implementation for ForAll is optimized for synchronous lambdas that don't need to allocate an AsyncStateMachine, while the ForAllAsync is optimized for increased concurrency for asynchronous lambdas. Choosing ForAll for synchronous lambdas massively decreases memory allocation and execution time.
  • IAsyncAction<T>'s InvokeAsync method now has a CancellationToken parameter.
  • Changes to TimeSpan related functions:
    • Format, FormatNonAllocated, ToRemainingDuration, ToRemainingDurationNonAllocated, ToTimeStamp, ToTimeStampNonAllocated, were all removed due to duplication and suboptimal implementations.
    • The new methods replacing these functionalities are now in Utils.DateAndTime namespace.
    • FormatTimeSpan is now replacing Format and FormatNonAllocated, FormatTimeSpan is hyper optimized. The first overload requires a Span{char} buffer of at least 30 characters, and returns a ReadOnlySpan{char} of the written portion. The second doesn't require a buffer, and allocated a new string which is returned. FormatTimeSpan outputs a different format than the predecessor, as the time was formatted in decimal and is rather confusing, now it is formatted as 00:00unit for the largest 2 units. So a minute and a half would be 01:30m and a day and a half would be 02:30d etc... this seems more intuitive to me.
    • FormatTimeStamp is now replacing ToTimeStamp and ToTimeStampNonAllocated, it is also optimized and the overloads work the same way as FormatTimeSpan.
  • The StringBuffer which previously rented arrays from the shared array pool, then used the same API's to write to it as AllocatedStringBuffer was removed. The previous AllocatedStringBuffer was now renamed to StringBuffer and it requires a pre-allocated Span{char}. You can get the same functionality by renting any buffer, and simply supplying to StringBuffer.Create. This allowed removal of a lot of duplicated code and made the API more consistent. StringBuffer now doesn't have an implicit converter to ReadOnlySpan{char} anymore, use StringBuffer.WrittenSpan instead.
  • IModifier{T} was removed, use Func<T, T> instead.
  • Utils.Strings.FormatBytes was changed in the same manner as Utils.DateAndTime.FormatTimeSpan and Utils.DateAndTime.FormatTimeStamp, it now returns a ReadOnlySpan<char> instead of a string and it is optimized to use less memory.
  • ThreadSafe<T> now implements IEquatable<T> and IEquatable<ThreadSafe<T>> to allow comparisons.

Upon the release of .NET 9, another version will be released utilizing certain optimizations specifically for .NET 9, but the feature set should be the same.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.
  • net8.0

    • No dependencies.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Sharpify:

Package Downloads
PrettyConsole

High performance, feature rich and easy to use wrap over System.Console

Sharpify.Data

An extension of Sharpify, focused on Data

Sharpify.CommandLineInterface

An extension of Sharpify, focused on creating command line interfaces

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.5.0 161 11/13/2024
2.4.0 392 10/21/2024
2.4.0-alpha 184 10/8/2024
2.2.0 551 7/26/2024
2.1.0 90 7/18/2024
2.0.0 152 6/3/2024
1.8.1 110 5/30/2024
1.8.0 120 4/17/2024
1.7.3 181 1/29/2024
1.7.2 124 1/23/2024
1.7.1 242 1/20/2024
1.7.0 97 1/20/2024
1.6.0 134 1/15/2024
1.5.0 119 1/10/2024
1.4.2 124 1/8/2024
1.4.1 164 1/4/2024
1.4.0 145 1/4/2024
1.3.1 136 12/31/2023
1.3.0 135 12/31/2023
1.2.0 136 12/24/2023
1.1.0 157 12/7/2023
1.0.9 119 12/7/2023
1.0.8 159 11/22/2023
1.0.7 131 9/23/2023
1.0.6 151 8/21/2023
1.0.5 166 5/4/2023
1.0.4 163 4/23/2023
1.0.3 169 4/19/2023
1.0.2 174 4/19/2023
1.0.1 182 4/14/2023
1.0.0 177 4/14/2023