neon-sunset / fast-cache

The fastest cache library written in C# for items with set expiration time. Easy to use, thread-safe and light on memory.
https://www.nuget.org/packages/FastCache.Cached/
MIT License
88 stars 8 forks source link

Bump RangeExtensions from 1.2.2 to 2.0.0 #24

Closed dependabot[bot] closed 1 year ago

dependabot[bot] commented 1 year ago

Bumps RangeExtensions from 1.2.2 to 2.0.0.

Release notes

Sourced from RangeExtensions's releases.

2.0.0

Changes

✨ New Features

Select and Where

This release expands the list of Range extensions with several convenience methods that bring it much closer to counterparts in Rust, Python and others.

var floats = (0..100).Select(i => (float)i);
var odd = (0..100).Where(i => i % 2 != 0);

var randomNumbers = (0..1000) .Select(_ => Random.Shared.Next()) .ToArray();

Iterating through these directly is significantly faster when compared to Enumerable.Range. In fact, with DynamicPGO enabled, on osx-arm64 the loop foreach (var i in (0..1000).Select(i => i * 2)) gets within 1.3-1.5x ratio of a regular plain for loop. Delegate devirtualization has gotten so good!

IList on RangeEnumerable and SelectRange

Now both these types also implement IList. While RangeEnumerable is effectively a materialized sequence of numbers, SelectRange serves a purpose of "Select View" over that sequence, with exact T values materialized on access similar to plain IEnumerable<T>.

While this does not conform 100% to existing semantics, it was a necessary change to take the advantage of IEnumerable internals for methods that lack bespoke implementations in this library or when RangeExtensions enumerators are boxed.

Bespoke Aggregate, First, Last and more

The library now exposes additional bespoke LINQ method implementations for shorthand usage together with Range that further improve its usability in functional scenarios.

var digits = (0..10)
    .Aggregate(new StringBuilder(), (sb, i) => sb.Append(i))
    .ToString();

Assert.Equal("0123456789", digits);

// None of these allocate, and all of them are O(1) var fifteenthDecimal = (0..1337) .Select(i => (decimal)i) .Take(10) .ElementAt(4); // or even just [4]

// Efficient scan from the end of the range var lastEven = (0..1337) .Where(i => i % 2 is 0) .Last();

... (truncated)

Commits
  • 234da64 Select and Where specialized impl. (#10)
  • b61b836 Bump Microsoft.NET.Test.Sdk from 17.4.0 to 17.4.1 (#13)
  • 1322760 Bump Microsoft.NET.Test.Sdk from 17.3.2 to 17.4.0 (#12)
  • 0539ba8 Bump coverlet.collector from 3.1.2 to 3.2.0 (#11)
  • f98a509 Add PackageProjetUrl to make github happy
  • 5af1e65 Bump Microsoft.NET.Test.Sdk from 17.3.1 to 17.3.2 (#9)
  • See full diff in compare view


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
coveralls commented 1 year ago

Coverage Status

Coverage: 92.913% (+0.2%) from 92.683% when pulling d9ec5ae61300a0a1fb830c5e54e01118d84da32a on dependabot/nuget/RangeExtensions-2.0.0 into af5c74db843ba7f9de091e6794d6fe2e07f49c37 on main.