Skip to content

Commit 70d3fc1

Browse files
authored
Merge pull request #19 from dusrdev/pre-release
Pre-release
2 parents 82c2cf0 + f38ffbe commit 70d3fc1

132 files changed

Lines changed: 453 additions & 9935 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ dotnet_diagnostic.IDE0301.severity = none # simplify collection initialization
8585
dotnet_diagnostic.IDE0053.severity = none # expression body lambda
8686
dotnet_diagnostic.IDE0046.severity = none # simplify if(s) - conditional operator
8787
dotnet_diagnostic.IDE0305.severity = none # [, ...] instead of .ToArray()
88+
dotnet_diagnostic.IDE0306.severity = none # Use collection expressions
8889

8990

9091
# namespace declaration

.gitattributes

Lines changed: 0 additions & 63 deletions
This file was deleted.

.github/workflows/Tests.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
platform: [ubuntu-latest, windows-latest, macos-latest]
13-
project: [tests/Sharpify.Tests/Sharpify.Tests.csproj, tests/Sharpify.CommandLineInterface.Tests/Sharpify.CommandLineInterface.Tests.csproj]
1413
uses: dusrdev/actions/.github/workflows/reusable-dotnet-test-mtp.yaml@main
1514
with:
1615
platform: ${{ matrix.platform }}
17-
dotnet-version: 9.0.x
18-
test-project-path: ${{ matrix.project }}
16+
dotnet-version: 10.0.x
17+
test-project-path: tests/Sharpify.Tests/Sharpify.Tests.csproj

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# CHANGELOG
2+
3+
* Only .NET 10+ support.
4+
* Some computed properties in `BufferWrapper{T}` were made `readonly` to hint the compiler to not create defensive copies.
5+
* `PersistentDictionary` in all of its variants have been removed - used `ArrowDb` instead.
6+
* `SerializableObject<T>`, `MonitoredSerializableObject<T>` and `ThreadSafe<T>` have all been combined into `Synchronized<T>` which is much simpler, more performant. But can be more manual as it isn't coupled with `File.IO`. Instead it provides a delegate that can be provided and called on update.
7+
* `Collections.IsNullOrEmpty` and all the other alias functions for `CollectionsMarshal` have been removed.
8+
* `Utils` subclasses have been flattened and all the contents will reside directly in `Utils`.
9+
* `Strings.FormatBytes` have been removed
10+
* `Path` utilities were also removed - use `AppContext` instead.
11+
* `String.IsNullOrEmpty|IsNullOrWhiteSpace|Concat` were also removed to enforce build-in language features.
12+
* `TryConvertFromTo32` was also removed - `int.Parse|TryParse` are more than fast enough now.
13+
* A struct `PooledArrayOwner{T}` was added to rent arrays from `ArrayPool{T}` without additional penalties.
14+
* Extensions to match were added to any `ArrayPool{T}` including `Shared`, they allow you to get the owner and the array at the same time. `using var owner = ArrayPool{T}.Shared.Rent(minLength, out T[] array);`
15+
* You can then proceed to use `BufferWrapper{T}.Create(array)` to get an `IBufferWriter` implementation over it.

README.md

Lines changed: 13 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,38 @@
11
# Sharpify
22

3-
A collection of high performance language extensions for C#, fully compatible with NativeAOT
4-
5-
## ⬇ Installation
6-
7-
[![Nuget](https://img.shields.io/nuget/dt/Sharpify?label=Sharpify%20Nuget%20Downloads)](https://www.nuget.org/packages/Sharpify/)
8-
> dotnet add package Sharpify
9-
10-
[![Nuget](https://img.shields.io/nuget/dt/Sharpify.Data?label=Sharpify.Data%20Nuget%20Downloads)](https://www.nuget.org/packages/Sharpify.Data/)
11-
> dotnet add package Sharpify.Data
12-
13-
* `Sharpify.Data` is deprecated and will no longer be maintained. Refer to [ArrowDb](https://github.com/dusrdev/ArrowDb) for a superior alternative.
14-
15-
[![Nuget](https://img.shields.io/nuget/dt/Sharpify.CommandLineInterface?label=Sharpify.CommandLineInterface%20Nuget%20Downloads)](https://www.nuget.org/packages/Sharpify.CommandLineInterface/)
16-
> dotnet add package Sharpify.CommandLineInterface
3+
[![NuGet](https://img.shields.io/nuget/v/Sharpify.svg?style=flat-square)](https://www.nuget.org/packages/Sharpify)
4+
[![NuGet Downloads](https://img.shields.io/nuget/dt/Sharpify?style=flat&label=Downloads)](https://www.nuget.org/packages/Sharpify)
5+
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](License.txt)
6+
[![.NET](https://img.shields.io/badge/.NET-10.0-512BD4?style=flat-square)](https://dotnet.microsoft.com/en-us/download/dotnet/10.0)
177

18-
## Sharpify - Base package
19-
20-
`Sharpify` is a package mainly intended to extend the core language using high performance implementations. The other 2 packages uses `Sharpify` as a dependency. But its core features can be useful in a variety of applications by themselves.
8+
A collection of high performance language extensions for C#, fully compatible with NativeAOT
219

2210
* ⚡ Fully Native AOT compatible
2311
* 🤷 `Either<T0, T1>` - Discriminated union object that forces handling of both cases
2412
* 🦾 Flexible `Result` type that can encapsulate any other type and adds a massage options and a success or failure status. Flexible as it doesn't require any special handling to use (unlike `Either`)
25-
* 🏄 Wrapper extensions that simplify use of common functions and advanced features from the `CollectionsMarshal` class
2613
* `Routine` and `AsyncRoutine` bring the user easily usable and configurable interval based background job execution.
27-
* `PersistentDictionary` and derived types are super lightweight and efficient serializable dictionaries that are thread-safe and work amazingly for things like configuration files.
2814
* `SortedList<T>` bridges the performance of `List` and order assurance of `SortedSet`
29-
* `PersistentDictionary` and variants provide all simple database needs, with perfected performance and optimized concurrency.
30-
* `SerializableObject` and the `Monitored` variant allow persisting an object to the disk, and elegantly synchronizing modifications.
15+
* `Synchronized<T>` is a thread-safe object owner with an optional delegate that can be executed on update.
3116
* 💿 `StringBuffer` enables zero allocation, easy to use appending buffer for creation of strings in hot paths.
32-
* `RentedBufferWriter{T}` is an allocation friendly alternative to `ArrayBufferWriter{T}` for hot paths.
17+
* `PooledArrayOwner{T}` is struct based alternative to `IMemoryOwner<T>` with extensions built into the `ArrayPool<T>` class.
18+
* `BufferWrapper{T}` is a ref struct implementation of `IBufferWriter{T}` that wraps a `Span<T>`.
3319
* A 🚣🏻 boat load of extension functions for all common types, bridging ease of use and performance.
34-
* `Utils.DateAndTime`, `Utils.Env`, `Utils.Math`, `Utils.Strings` and `Utils.Unsafe` provide uncanny convenience at maximal performance.
35-
* 🧵 `ThreadSafe<T>` makes any variable type thread-safe
20+
* A bunch of utils in `Utils` class.
3621
* 🔐 `AesProvider` provides access to industry leading AES-128 encryption with virtually no setup
3722
* 🏋️ High performance optimized alternatives to core language extensions
38-
* 🎁 More added features that are not present in the core language
39-
* ❗ Static inner exception throwers guide the JIT to further optimize the code during runtime.
4023
* 🫴 Focus on giving the user complete control by using flexible and common types, and resulting types that can be further used and just viewed.
4124

42-
For more information check [inner directory](src/Sharpify/README.md).
43-
44-
## Sharpify.Data
45-
46-
`Sharpify.Data` is an extension package, that should be installed on-top of `Sharpify` and adds a high performance persistent key-value-pair database, utilizing [MemoryPack](https://github.com/Cysharp/MemoryPack). The database support multiple types in the same file, 2 stage AES encryption (for whole file and per-key). Filtering by type, Single or Array value per key, and more...
47-
48-
* `Database` is the base type for the data base, it is key-value-pair based local database - saved on disk.
49-
* `IDatabaseFilter<T>` is an interface which acts as an alternative to `DbContext` and provides enhanced type safety for contexts.
50-
* `MemoryPackDatabaseFilter<T>` is an implementation which focuses on types that implement `IMemoryPackable<T>` from `MemoryPack`.
51-
* `FlexibleDatabaseFilter<T>` is an implementation focusing on types which need custom serialization logic. To use this, you type `T` will need to implement `IFilterable<T>` which has methods for serialization and deserialization of single `T` and `T[]`. If you can choose to implement only one of the two.
52-
* **Concurrency** - `Database` uses highly performant synchronous concurrency models and is completely thread-safe.
53-
* **Disk Usage** - `Database` tracks inner changes and skips serialization if no changes occurred, enabling usage of periodic serialization without resource waste.
54-
* **GC Optimization** - `Database` heavily uses pooling for encryption, decryption, type conversion, serialization and deserialization to minimize GC overhead, very rarely does it allocate single-use memory and only when absolutely necessary.
55-
* **HotPath APIs** - `Database` is optimized for hot paths, as such it provides a number of APIs that specifically combine features for maximum performance and minimal GC overhead. Like the `TryReadToRentedBuffer<T>` methods which is optimized for adding data to a table.
56-
* **Runtime Optimization** - Upon initialization, `Database` chooses specific serializers and deserializers tailored for specific configurations, minimizing the amount of runnable code during runtime that would've been wasted on different checks.
25+
## ⬇ Installation
5726

58-
For more information check [inner directory](src/Sharpify.Data/README.md).
27+
> dotnet add package Sharpify
5928
6029
## Sharpify.CommandLineInterface
6130

6231
`Sharpify.CommandLineInterface` is a standalone package that adds a high performance, reflection free and `AOT-ready` framework for creating command line and embedded interfaces
6332

64-
* Maintenance friendly model that depends on classes that implement `Command` or `SynchronousCommand`
65-
* `Arguments` is an abstraction layer over the inputs that validate during runtime according to user needs via convenient APIs.
66-
* Configuration using a fluent builder pattern.
67-
* Configurable output and input pipes, enable usage outside of `Console` apps, supporting embedded use in any application.
68-
* Automatic and structured general and command-specific help text.
69-
* Configurable error handling with defaults.
70-
* Super lightweight
33+
It was moved to its own repo [Sharpify.CommandLineInterface](https://github.com/dusrdev/Sharpify.CommandLineInterface)
7134

72-
For more information check [inner directory](src/Sharpify.CommandLineInterface/README.md)
35+
##
7336

7437
## Methodology
7538

Sharpify.slnx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<Solution>
2-
<Project Path="src/Sharpify.CommandLineInterface/Sharpify.CommandLineInterface.csproj" />
3-
<Project Path="src/Sharpify/Sharpify.csproj" />
4-
<Project Path="tests/Sharpify.CommandLineInterface.Tests/Sharpify.CommandLineInterface.Tests.csproj" />
5-
<Project Path="tests/Sharpify.Tests/Sharpify.Tests.csproj" />
2+
<Folder Name="/src/">
3+
<Project Path="src/Sharpify/Sharpify.csproj" />
4+
</Folder>
5+
<Folder Name="/tests/">
6+
<Project Path="tests/Sharpify.Tests/Sharpify.Tests.csproj" />
7+
</Folder>
68
</Solution>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# CHANGELOG
22

3+
## v3.0.0
4+
5+
* Only .NET 10+ support.
6+
* Some computed properties in `BufferWrapper{T}` were made `readonly` to hint the compiler to not create defensive copies.
7+
* `PersistentDictionary` in all of its variants have been removed - used `ArrowDb` instead.
8+
* `SerializableObject<T>`, `MonitoredSerializableObject<T>` and `ThreadSafe<T>` have all been combined into `Synchronized<T>` which is much simpler, more performant. But can be more manual as it isn't coupled with `File.IO`. Instead it provides a delegate that can be provided and called on update.
9+
* `Collections.IsNullOrEmpty` and all the other alias functions for `CollectionsMarshal` have been removed.
10+
* `Utils` subclasses have been flattened and all the contents will reside directly in `Utils`.
11+
* `Strings.FormatBytes` have been removed
12+
* `Path` utilities were also removed - use `AppContext` instead.
13+
* `String.IsNullOrEmpty|IsNullOrWhiteSpace|Concat` were also removed to enforce build-in language features.
14+
* `TryConvertFromTo32` was also removed - `int.Parse|TryParse` are more than fast enough now.
15+
* A struct `PooledArrayOwner{T}` was added to rent arrays from `ArrayPool{T}` without additional penalties.
16+
* Extensions to match were added to any `ArrayPool{T}` including `Shared`, they allow you to get the owner and the array at the same time. `using var owner = ArrayPool{T}.Shared.Rent(minLength, out T[] array);`
17+
* You can then proceed to use `BufferWrapper{T}.Create(array)` to get an `IBufferWriter` implementation over it.
18+
319
## v2.5.0
420

521
* Updated to support .NET 9.0 and optimized certain methods to use .NET 9 specific API's wherever possible.

demos/Calc/Calc.sln

Lines changed: 0 additions & 16 deletions
This file was deleted.

demos/Calc/Calc/Calc.csproj

Lines changed: 0 additions & 38 deletions
This file was deleted.

demos/Calc/Calc/Commands/AddCommand.cs

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)