Skip to content

Commit 1c651d6

Browse files
committed
releasing v4.0.0
1 parent 2b7e3e6 commit 1c651d6

File tree

6 files changed

+51
-42
lines changed

6 files changed

+51
-42
lines changed

BuildScripts/NuGetPublish.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ set PACKAGES=.dist\packages
44
set SOURCE=https://api.nuget.org/v3/index.json
55
set /p APIKEY=<"..\ApiKey.txt"
66

7-
dotnet nuget push "%PACKAGES%\ImTools.dll.3.1.0.nupkg" -k %APIKEY% -s %SOURCE%
8-
dotnet nuget push "%PACKAGES%\ImTools.3.1.0.nupkg" -k %APIKEY% -s %SOURCE%
7+
dotnet nuget push "%PACKAGES%\ImTools.dll.4.0.0.nupkg" -k %APIKEY% -s %SOURCE%
8+
dotnet nuget push "%PACKAGES%\ImTools.4.0.0.nupkg" -k %APIKEY% -s %SOURCE%
99

1010
echo:
1111
echo:Publishing completed.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
- Windows, Linux, MacOS [![CI build](https://ci.appveyor.com/api/projects/status/el9echuqfnl86u53?svg=true)](https://ci.appveyor.com/project/MaksimVolkau/imtools/branch/master)
77
- Lib package [![NuGet Badge](https://buildstats.info/nuget/ImTools.dll)](https://www.nuget.org/packages/ImTools.dll)
88
- Code package [![NuGet Badge](https://buildstats.info/nuget/ImTools)](https://www.nuget.org/packages/ImTools)
9-
- Latest release [![latest release](https://img.shields.io/badge/latest%20release-v3.1.0-green)](https://github.com/dadhi/ImTools/releases/tag/v3.1.0)
9+
- Latest release [![latest release](https://img.shields.io/badge/latest%20release-v4.0.0-green)](https://github.com/dadhi/ImTools/releases/tag/v4.0.0)
1010

1111
Fast and memory-efficient immutable collections and helper data structures.
1212

nuspecs/ImTools.nuspec

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
33
<metadata minClientVersion="3.3.0">
44
<id>ImTools</id>
5-
<version>3.1.0</version>
5+
<version>4.0.0</version>
66
<authors>Maksim Volkau</authors>
7-
<copyright>Copyright © 2016-2021 Maksim Volkau</copyright>
7+
<copyright>Copyright © 2016-2022 Maksim Volkau</copyright>
88
<projectUrl>https://github.com/dadhi/ImTools</projectUrl>
99
<license type="expression">MIT</license>
1010
<requireLicenseAcceptance>false</requireLicenseAcceptance>
@@ -17,19 +17,30 @@
1717
<tags>FP Performance Simple Functional Immutable Persistent Map Avl 2-3Tree Self Balanced Tree Dictionary Thread-safe Functional Atomic Ref Algebraic Discriminated Union SumType</tags>
1818
<releaseNotes>
1919
<![CDATA[
20-
## v3.1.0 Minor feature and bug-fix release
20+
## v4.0.0 Major release
2121
22-
- fixed: #44 the Im(Hash)Map.Entry methods should return the entry type but now return the map type
23-
- fixed: Excessive memory consumption and potential issue in ArrayTools.Match for 2 items
24-
- added: More efficient Im(Hash)Map ToArray() method
25-
- added: ImHashMap ForEach with the struct IHandler
26-
- added: ArrayTools.AppendNonEmpty and PrependToNonEmpty methods
22+
### Breaking changes
2723
28-
## v3.0.0 Major feature release
24+
`ImMap<V>` type is replaced by ImHashMap<int, V>`.
25+
The implementations of ImMap and ImHashMap are combined into one, reducing the code size, and using all performance optimizations from the both.
26+
This change will simplify further performance improvements, testing and bug-fixes.
2927
30-
- Minimizing the target frameworks to the net45 and netstandard2.0
31-
- Added fast and more memory efficient ImMap and ImHashMap based on 2-3 tree (#32, #35)
32-
- Extended the map API with AddOrGetEntry, Count, ToArray, and ToDictionary methods, and more
28+
I have tried to keep the API as similar as possible,
29+
but you may expect that some types and methods were renamed, or new overloads were added.
30+
31+
### Performance and memory improvements
32+
33+
- Fewer allocations (~10%), see the benchmarks in project readme
34+
- Keeping the performance almost the same
35+
36+
### Closed issues
37+
38+
- #41 Add a builder-like capability to the ImHashMap via BuildFromDifferent methods
39+
- #47 Add output of the ImHashMap as mermaid diagram, e.g. `ToMermaidString` method
40+
- #48 Merge the ImMap and ImHashMap implementations
41+
- #50 Optimize Enumerable for the PartitionedHashMap
42+
- #51 Reduce ImHashMap memory allocations, keeping the speed
43+
- #52 Add AddSureNotPresent methods to compensate for GetSurePresent methods
3344
3445
]]>
3546
</releaseNotes>

src/ImTools/ImTools.cs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public static T[] CopyNonEmpty<T>(this T[] source)
246246
return copy;
247247
}
248248

249-
/// <summary>Returns the new array consisting from all items from source array then the all items from added array.
249+
/// <summary>Returns the new array consisting of all items from source array then the all items from added array.
250250
/// If source is null or empty then the added array will be returned. If added is null or empty then the source will be returned.</summary>
251251
public static T[] Append<T>(this T[] source, params T[] added)
252252
{
@@ -402,7 +402,6 @@ public static int IndexOf<T>(this T[] source, T value)
402402
if (Equals(item, value))
403403
return i;
404404
}
405-
406405
return -1;
407406
}
408407

@@ -446,7 +445,6 @@ public static T FindFirst<T>(this T[] source, Func<T, bool> predicate)
446445
if (predicate(item))
447446
return item;
448447
}
449-
450448
return default(T);
451449
}
452450

@@ -460,7 +458,6 @@ public static T FindFirst<T, S>(this T[] source, S state, Func<S, T, bool> predi
460458
if (predicate(state, item))
461459
return item;
462460
}
463-
464461
return default(T);
465462
}
466463

@@ -547,10 +544,8 @@ private static R[] AppendTo<T, R>(T[] source, int sourcePos, int count, Func<T,
547544
if (count == 1)
548545
appendedResults[oldResultsCount] = map(source[sourcePos]);
549546
else
550-
{
551547
for (int i = oldResultsCount, j = sourcePos; i < appendedResults.Length; ++i, ++j)
552548
appendedResults[i] = map(source[j]);
553-
}
554549

555550
return appendedResults;
556551
}
@@ -578,10 +573,8 @@ private static R[] AppendTo<S, T, R>(T[] source, S state, int sourcePos, int cou
578573
if (count == 1)
579574
appendedResults[oldResultsCount] = map(state, source[sourcePos]);
580575
else
581-
{
582576
for (int i = oldResultsCount, j = sourcePos; i < appendedResults.Length; ++i, ++j)
583577
appendedResults[i] = map(state, source[j]);
584-
}
585578

586579
return appendedResults;
587580
}
@@ -609,10 +602,8 @@ private static R[] AppendTo<A, B, T, R>(T[] source, A a, B b, int sourcePos, int
609602
if (count == 1)
610603
appendedResults[oldResultsCount] = map(a, b, source[sourcePos]);
611604
else
612-
{
613605
for (int i = oldResultsCount, j = sourcePos; i < appendedResults.Length; ++i, ++j)
614606
appendedResults[i] = map(a, b, source[j]);
615-
}
616607

617608
return appendedResults;
618609
}
@@ -1256,9 +1247,7 @@ public static int Combine<T1, T2>(T1 a, T2 b)
12561247
if (ReferenceEquals(a, null))
12571248
return bh;
12581249
var ah = a.GetHashCode();
1259-
if (ah == 0)
1260-
return bh;
1261-
return Combine(ah, bh);
1250+
return ah == 0 ? bh : Combine(ah, bh);
12621251
}
12631252

12641253
/// <summary>Inspired by System.Tuple.CombineHashCodes</summary>
@@ -1513,7 +1502,6 @@ public T[] ResizeToArray()
15131502
return items;
15141503
}
15151504

1516-
// todo: @naming think of the better name
15171505
/// <summary>Pops the item - just moving the counter back</summary>
15181506
public T PopItem() => Items[--Count];
15191507

@@ -1991,7 +1979,6 @@ internal override Entry AddOrUpdateWithTheSameHashByReferenceEquals(ImHashMapEnt
19911979
return ReferenceEquals(key, e._key) ? ImHashMap.Entry(Hash, key, update(key, Value, e.Value)) : new HashConflictingEntry(Hash, this, e);
19921980
}
19931981

1994-
// todo: @wip better method names aligned with the calling side
19951982
internal override ImHashMap<K, V> GetMapOrReplaceWithEntry(ImHashMap<K, V> oldMap, ImHashMapEntry<K, V> newEntry)
19961983
{
19971984
var e = (KVEntry<K, V>)newEntry;

src/ImTools/ImTools.csproj

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<TargetFrameworks>net45;netstandard2.0</TargetFrameworks>
44

55
<Product>ImTools</Product>
6-
<VersionPrefix>3.1.0</VersionPrefix>
6+
<VersionPrefix>4.0.0</VersionPrefix>
77
<VersionSuffix></VersionSuffix>
88

99
<AssemblyName>$(Product)</AssemblyName>
@@ -20,20 +20,31 @@
2020
<PackageTags>FP Performance Simple Functional Immutable Persistent Map Avl 2-3Tree Self Balanced Tree Dictionary Thread-safe Functional Atomic Ref Algebraic Discriminated Union SumType</PackageTags>
2121
<PackageReleaseNotes>
2222
<![CDATA[
23-
## v3.1.0 Minor feature and bug-fix release
2423
25-
- fixed: #44 the Im(Hash)Map.Entry methods should return the entry type but now return the map type
26-
- fixed: Excessive memory consumption and potential issue in ArrayTools.Match for 2 items
27-
- added: More efficient Im(Hash)Map ToArray() method
28-
- added: ImHashMap ForEach with the struct IHandler
29-
- added: ArrayTools.AppendNonEmpty and PrependToNonEmpty methods
24+
## v4.0.0 Major release
3025
26+
### Breaking changes
3127
32-
## v3.0.0 Major feature release
28+
`ImMap<V>` type is replaced by ImHashMap<int, V>`.
29+
The implementations of ImMap and ImHashMap are combined into one, reducing the code size, and using all performance optimizations from the both.
30+
This change will simplify further performance improvements, testing and bug-fixes.
3331
34-
- Minimizing the target frameworks to the net45 and netstandard2.0
35-
- Added fast and more memory efficient ImMap and ImHashMap based on 2-3 tree (#32, #35)
36-
- Extended the map API with AddOrGetEntry, Count, ToArray, and ToDictionary methods, and more
32+
I have tried to keep the API as similar as possible,
33+
but you may expect that some types and methods were renamed, or new overloads were added.
34+
35+
### Performance and memory improvements
36+
37+
- Fewer allocations (~10%), see the benchmarks in project readme
38+
- Keeping the performance almost the same
39+
40+
### Closed issues
41+
42+
- #41 Add a builder-like capability to the ImHashMap via BuildFromDifferent methods
43+
- #47 Add output of the ImHashMap as mermaid diagram, e.g. `ToMermaidString` method
44+
- #48 Merge the ImMap and ImHashMap implementations
45+
- #50 Optimize Enumerable for the PartitionedHashMap
46+
- #51 Reduce ImHashMap memory allocations, keeping the speed
47+
- #52 Add AddSureNotPresent methods to compensate for GetSurePresent methods
3748
3849
]]>
3950
</PackageReleaseNotes>

test/ImTools.UnitTests/ImTools.V2.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
The MIT License (MIT)
44
5-
Copyright (c) 2016-2021 Maksim Volkau
5+
Copyright (c) 2016-2022 Maksim Volkau
66
77
Permission is hereby granted, free of charge, to any person obtaining a copy
88
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)