Releases: p6laris/MorseSharp
MorseSharp v5.0.0
Highlights
1. New Custom Hash Tables
Introduced MorseTable256 and MorseTableReverse256 fixed-size (256 slots) hash tables using open addressing and custom hashing to improve the efficiency of Morse code character storage and lookup.
2. Enhanced Language Character Sets
Refined and corrected Morse code characters across supported languages, including proper handling of language-specific diacritics and special symbols.
3. Performance Improvements
Significant speed-ups thanks to custom hashing optimizations:
-
Encoding speed doubled: from ~80 ns to ~40 ns per operation (memory allocations remain ~40 bytes).
-
Decoding speed improved ~2.4x faster: from ~118 ns to ~49 ns per operation, with memory allocations reduced by 66.7% (from ~96 bytes to ~32 bytes).
BenchmarkDotNet v0.15.2, Linux Fedora Linux 42 (Workstation Edition)
Intel Core i7-9750H CPU 2.60GHz, 1 CPU, 12 logical and 6 physical cores .NET SDK 9.0.300
[Host] : .NET 9.0.6 (9.0.625.26613), X64 RyuJIT AVX2
DefaultJob : .NET 9.0.6 (9.0.625.26613), X64 RyuJIT AVX2
| Method | Mean | Error | StdDev | Ratio | RatioSD | Rank | Gen0 | Allocated | Alloc Ratio |
|----------------------------- |---------------:|--------------:|--------------:|-----------:|---------:|-----:|-------:|----------:|------------:|
| 'Construct Morse Converter' | 2.353 ns | 0.0383 ns | 0.0358 ns | 1.00 | 0.02 | 1 | - | - | NA |
| 'Encode Short: Hi' | 40.552 ns | 0.3135 ns | 0.2618 ns | 17.24 | 0.28 | 2 | 0.0063 | 40 B | NA |
| 'Decode Short: Hi' | 48.276 ns | 0.3557 ns | 0.2777 ns | 20.52 | 0.33 | 3 | 0.0051 | 32 B | NA |
| 'Encode Medium: Hello World' | 134.795 ns | 2.1916 ns | 1.9428 ns | 57.31 | 1.17 | 4 | 0.0176 | 112 B | NA |
| 'Decode Medium: Hello World' | 163.579 ns | 0.5814 ns | 0.5154 ns | 69.54 | 1.06 | 5 | 0.0076 | 48 B | NA |
| 'Encode Long: Pangram' | 447.220 ns | 2.3593 ns | 2.2069 ns | 190.13 | 2.97 | 6 | 0.0534 | 336 B | NA |
| 'Decode Long: Pangram' | 581.698 ns | 3.9293 ns | 3.4832 ns | 247.30 | 3.95 | 7 | 0.0172 | 112 B | NA |
| 'Audio Short: Hi' | 27,872.083 ns | 324.8230 ns | 303.8396 ns | 11,849.21 | 216.17 | 8 | - | 40 B | NA |
| 'Audio Medium: Hello World' | 162,714.842 ns | 238.2646 ns | 222.8728 ns | 69,174.70 | 1,033.31 | 9 | - | 112 B | NA |
| 'Audio Long: Pangram)' | 594,312.505 ns | 1,786.4338 ns | 1,491.7531 ns | 252,659.10 | 3,809.83 | 10 | - | 336 B | NA |
Breaking Changes
- MorseCharacters.GetLanguageCharacter now returns
MorseTable256instead ofDictionary<char, string>. - Added GetLanguageCharacterReversed returning
MorseTableReverse256for reverse lookup. - Renamed language enum values:
- Espanol → Spanish
- Francais → French
- Italiano → Italian
MorseSharp v4.1.4
Fix bug (70976c0)
MorseSharp v4.1.3
1.Better audio generator performance (~3x faster)
BenchmarkDotNet v0.14.0, Windows 11 (10.0.26100.2033)
Intel Core i7-9750H CPU 2.60GHz, 1 CPU, 12 logical and 6 physical cores
.NET SDK 9.0.100
[Host] : .NET 9.0.0 (9.0.24.52809), X64 RyuJIT AVX2 [AttachedDebugger]
ShortRun : .NET 9.0.0 (9.0.24.52809), X64 RyuJIT AVX2
Job=ShortRun IterationCount=3 LaunchCount=1
WarmupCount=3
| Method | Mean | Error | StdDev | Allocated |
|---|---|---|---|---|
| Audio | 11.58 μs | 0.078 μs | 0.069 μs | 32 B |
2.Bug fix: The decoder does not append a space when it encounters '/'.
MorseSharp v4.1.2
- Supports .NET 9
- Performance Improvements
- Delete unsafe keywords
BenchmarkDotNet v0.14.0, Windows 11 (10.0.26100.2033)
Intel Core i7-9750H CPU 2.60GHz, 1 CPU, 12 logical and 6 physical cores
.NET SDK 9.0.100
[Host] : .NET 9.0.0 (9.0.24.52809), X64 RyuJIT AVX2 [AttachedDebugger]
ShortRun : .NET 9.0.0 (9.0.24.52809), X64 RyuJIT AVX2
Job=ShortRun IterationCount=3 LaunchCount=1
WarmupCount=3
| Method | Mean | Error | StdDev | Gen0 | Allocated |
|---|---|---|---|---|---|
| ToMorse | 84.18 ns | 13.78 ns | 0.755 ns | 0.0063 | 40 B |
| ToText | 118.08 ns | 46.96 ns | 2.574 ns | 0.0153 | 96 B |
| ToAudio | 34,818.37 ns | 5,034.19 ns | 275.941 ns | - | 40 B |
MorseSharp v4.1.1
Performance improvments
MorseSharp v4.1.0
- Added '!'.
- The exceptions now expose properties to give more information about the error.
- Standardize russian punctuation and special characters.
MorseSharp v4.0.1
Standardized MorseSharp by using dashes as '-' instead of '_'.
MorseSharp v4.0.0
Fluent API design
- Reorganized the MorseSharp library to introduce a fluent API structure.
- All Morse code conversions, including decoding, encoding, audio generation, and light blinking, are now conveniently accessible through a single Morse singleton class.
- Simplified the usage by providing a fluent interface for a smoother and more intuitive experience.
Light Support 🔦
MorseSharp now can generate lights, by using ToLight then set the option, finally subscribe to the async DoBlinks's method Action<bool> delegate parameter:
Morse.GetConverter()
.ForLanguage(Language.English)
.ToLight(".... ..")
.SetBlinkerOptions(20, 25)
.DoBlinks((hasToBlink) => { });Performance 🚀
One of the main focus of this release was tuning the performance:
- Significantly improved performance by implementing ref structs and utilizing Span.
- Introduced pooling mechanisms to enhance memory management, resulting in more efficient resource utilization.
- CommunityToolkit SpanOnwer, ListPool were used.
Benchmarks
MorseSharp v3.2.0
BenchmarkDotNet v0.13.10, Windows 11 (10.0.22621.2715/22H2/2022Update/SunValley2)
Intel Core i7-9750H CPU 2.60GHz, 1 CPU, 12 logical and 6 physical cores
.NET SDK 7.0.102
[Host] : .NET 7.0.14 (7.0.1423.51910), X64 RyuJIT AVX2 [AttachedDebugger]
DefaultJob : .NET 7.0.14 (7.0.1423.51910), X64 RyuJIT AVX2
| Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated |
|---|---|---|---|---|---|---|
| ToMorse | 1.224 μs | 0.0292 μs | 0.0841 μs | 0.7706 | 0.0095 | 4.73 KB |
| ToText | 1.335 μs | 0.0265 μs | 0.0735 μs | 0.8144 | 0.0095 | 5 KB |
| ToAudio | 595.634 μs | 11.8373 μs | 14.0914 μs | 132.8125 | 26.3672 | 817 KB |
MorseSharp v4.0.0
BenchmarkDotNet v0.13.9+228a464e8be6c580ad9408e98f18813f6407fb5a, Windows 11 (10.0.22621.2715/22H2/2022Update/SunValley2)
Intel Core i7-9750H CPU 2.60GHz, 1 CPU, 12 logical and 6 physical cores
.NET SDK 8.0.100
[Host] : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2 [AttachedDebugger]
DefaultJob : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2
| Method | Mean | Error | StdDev | Gen0 | Allocated |
|---|---|---|---|---|---|
| ToMorse | 215.8 ns | 2.24 ns | 1.98 ns | 0.0088 | 56 B |
| ToText | 362.6 ns | 5.98 ns | 5.30 ns | 0.0153 | 96 B |
| ToAudioBytes | 87,060.7 ns | 1,145.76 ns | 956.76 ns | - | 249 B |
MorseSharp v3.2.0
Added Russian language and some bug fixes, micro-optimization.
MorseSharp v3.1.1
Added Kurdish Latin.