Skip to content

Commit

Permalink
releasing v4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dadhi committed Jul 25, 2022
1 parent 2b7e3e6 commit 1c651d6
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 42 deletions.
4 changes: 2 additions & 2 deletions BuildScripts/NuGetPublish.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ set PACKAGES=.dist\packages
set SOURCE=https://api.nuget.org/v3/index.json
set /p APIKEY=<"..\ApiKey.txt"

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

echo:
echo:Publishing completed.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- Windows, Linux, MacOS [![CI build](https://ci.appveyor.com/api/projects/status/el9echuqfnl86u53?svg=true)](https://ci.appveyor.com/project/MaksimVolkau/imtools/branch/master)
- Lib package [![NuGet Badge](https://buildstats.info/nuget/ImTools.dll)](https://www.nuget.org/packages/ImTools.dll)
- Code package [![NuGet Badge](https://buildstats.info/nuget/ImTools)](https://www.nuget.org/packages/ImTools)
- 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)
- 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)

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

Expand Down
35 changes: 23 additions & 12 deletions nuspecs/ImTools.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="3.3.0">
<id>ImTools</id>
<version>3.1.0</version>
<version>4.0.0</version>
<authors>Maksim Volkau</authors>
<copyright>Copyright © 2016-2021 Maksim Volkau</copyright>
<copyright>Copyright © 2016-2022 Maksim Volkau</copyright>
<projectUrl>https://github.com/dadhi/ImTools</projectUrl>
<license type="expression">MIT</license>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
Expand All @@ -17,19 +17,30 @@
<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>
<releaseNotes>
<![CDATA[
## v3.1.0 Minor feature and bug-fix release
## v4.0.0 Major release
- fixed: #44 the Im(Hash)Map.Entry methods should return the entry type but now return the map type
- fixed: Excessive memory consumption and potential issue in ArrayTools.Match for 2 items
- added: More efficient Im(Hash)Map ToArray() method
- added: ImHashMap ForEach with the struct IHandler
- added: ArrayTools.AppendNonEmpty and PrependToNonEmpty methods
### Breaking changes
## v3.0.0 Major feature release
`ImMap<V>` type is replaced by ImHashMap<int, V>`.
The implementations of ImMap and ImHashMap are combined into one, reducing the code size, and using all performance optimizations from the both.
This change will simplify further performance improvements, testing and bug-fixes.
- Minimizing the target frameworks to the net45 and netstandard2.0
- Added fast and more memory efficient ImMap and ImHashMap based on 2-3 tree (#32, #35)
- Extended the map API with AddOrGetEntry, Count, ToArray, and ToDictionary methods, and more
I have tried to keep the API as similar as possible,
but you may expect that some types and methods were renamed, or new overloads were added.
### Performance and memory improvements
- Fewer allocations (~10%), see the benchmarks in project readme
- Keeping the performance almost the same
### Closed issues
- #41 Add a builder-like capability to the ImHashMap via BuildFromDifferent methods
- #47 Add output of the ImHashMap as mermaid diagram, e.g. `ToMermaidString` method
- #48 Merge the ImMap and ImHashMap implementations
- #50 Optimize Enumerable for the PartitionedHashMap
- #51 Reduce ImHashMap memory allocations, keeping the speed
- #52 Add AddSureNotPresent methods to compensate for GetSurePresent methods
]]>
</releaseNotes>
Expand Down
17 changes: 2 additions & 15 deletions src/ImTools/ImTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public static T[] CopyNonEmpty<T>(this T[] source)
return copy;
}

/// <summary>Returns the new array consisting from all items from source array then the all items from added array.
/// <summary>Returns the new array consisting of all items from source array then the all items from added array.
/// 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>
public static T[] Append<T>(this T[] source, params T[] added)
{
Expand Down Expand Up @@ -402,7 +402,6 @@ public static int IndexOf<T>(this T[] source, T value)
if (Equals(item, value))
return i;
}

return -1;
}

Expand Down Expand Up @@ -446,7 +445,6 @@ public static T FindFirst<T>(this T[] source, Func<T, bool> predicate)
if (predicate(item))
return item;
}

return default(T);
}

Expand All @@ -460,7 +458,6 @@ public static T FindFirst<T, S>(this T[] source, S state, Func<S, T, bool> predi
if (predicate(state, item))
return item;
}

return default(T);
}

Expand Down Expand Up @@ -547,10 +544,8 @@ private static R[] AppendTo<T, R>(T[] source, int sourcePos, int count, Func<T,
if (count == 1)
appendedResults[oldResultsCount] = map(source[sourcePos]);
else
{
for (int i = oldResultsCount, j = sourcePos; i < appendedResults.Length; ++i, ++j)
appendedResults[i] = map(source[j]);
}

return appendedResults;
}
Expand Down Expand Up @@ -578,10 +573,8 @@ private static R[] AppendTo<S, T, R>(T[] source, S state, int sourcePos, int cou
if (count == 1)
appendedResults[oldResultsCount] = map(state, source[sourcePos]);
else
{
for (int i = oldResultsCount, j = sourcePos; i < appendedResults.Length; ++i, ++j)
appendedResults[i] = map(state, source[j]);
}

return appendedResults;
}
Expand Down Expand Up @@ -609,10 +602,8 @@ private static R[] AppendTo<A, B, T, R>(T[] source, A a, B b, int sourcePos, int
if (count == 1)
appendedResults[oldResultsCount] = map(a, b, source[sourcePos]);
else
{
for (int i = oldResultsCount, j = sourcePos; i < appendedResults.Length; ++i, ++j)
appendedResults[i] = map(a, b, source[j]);
}

return appendedResults;
}
Expand Down Expand Up @@ -1256,9 +1247,7 @@ public static int Combine<T1, T2>(T1 a, T2 b)
if (ReferenceEquals(a, null))
return bh;
var ah = a.GetHashCode();
if (ah == 0)
return bh;
return Combine(ah, bh);
return ah == 0 ? bh : Combine(ah, bh);
}

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

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

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

// todo: @wip better method names aligned with the calling side
internal override ImHashMap<K, V> GetMapOrReplaceWithEntry(ImHashMap<K, V> oldMap, ImHashMapEntry<K, V> newEntry)
{
var e = (KVEntry<K, V>)newEntry;
Expand Down
33 changes: 22 additions & 11 deletions src/ImTools/ImTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFrameworks>net45;netstandard2.0</TargetFrameworks>

<Product>ImTools</Product>
<VersionPrefix>3.1.0</VersionPrefix>
<VersionPrefix>4.0.0</VersionPrefix>
<VersionSuffix></VersionSuffix>

<AssemblyName>$(Product)</AssemblyName>
Expand All @@ -20,20 +20,31 @@
<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>
<PackageReleaseNotes>
<![CDATA[
## v3.1.0 Minor feature and bug-fix release
- fixed: #44 the Im(Hash)Map.Entry methods should return the entry type but now return the map type
- fixed: Excessive memory consumption and potential issue in ArrayTools.Match for 2 items
- added: More efficient Im(Hash)Map ToArray() method
- added: ImHashMap ForEach with the struct IHandler
- added: ArrayTools.AppendNonEmpty and PrependToNonEmpty methods
## v4.0.0 Major release
### Breaking changes
## v3.0.0 Major feature release
`ImMap<V>` type is replaced by ImHashMap<int, V>`.
The implementations of ImMap and ImHashMap are combined into one, reducing the code size, and using all performance optimizations from the both.
This change will simplify further performance improvements, testing and bug-fixes.
- Minimizing the target frameworks to the net45 and netstandard2.0
- Added fast and more memory efficient ImMap and ImHashMap based on 2-3 tree (#32, #35)
- Extended the map API with AddOrGetEntry, Count, ToArray, and ToDictionary methods, and more
I have tried to keep the API as similar as possible,
but you may expect that some types and methods were renamed, or new overloads were added.
### Performance and memory improvements
- Fewer allocations (~10%), see the benchmarks in project readme
- Keeping the performance almost the same
### Closed issues
- #41 Add a builder-like capability to the ImHashMap via BuildFromDifferent methods
- #47 Add output of the ImHashMap as mermaid diagram, e.g. `ToMermaidString` method
- #48 Merge the ImMap and ImHashMap implementations
- #50 Optimize Enumerable for the PartitionedHashMap
- #51 Reduce ImHashMap memory allocations, keeping the speed
- #52 Add AddSureNotPresent methods to compensate for GetSurePresent methods
]]>
</PackageReleaseNotes>
Expand Down
2 changes: 1 addition & 1 deletion test/ImTools.UnitTests/ImTools.V2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
The MIT License (MIT)
Copyright (c) 2016-2021 Maksim Volkau
Copyright (c) 2016-2022 Maksim Volkau
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down

0 comments on commit 1c651d6

Please sign in to comment.