Skip to content

12-02-2022

Compare
Choose a tag to compare
@ledjon-behluli ledjon-behluli released this 02 Dec 12:01
· 506 commits to master since this release

OrleanSpaces.Analyzers

NuGet v0.1.1

Features

  • OSA001 - Avoid instantiation of empty SpaceTuple by default constructor or expression.
  • OSA002 - Avoid constructor instantiation of SpaceTemplate having only SpaceUnit type arguments.
  • OSA003 - The supplied argument type is not supported.

OrleanSpaces

NuGet v0.2.0

Features

  • Avoiding generation of async state machines via async eliding on some of the methods of ISpaceAgent.

Breaking Changes

  • SpaceUnit.Null has been removed.

The idea of this property was to serve a static value of type SpaceUnit via a read-only reference, as opposed to new'ing the same value every time. The problem was that in actuality it is more performant to simply new a value as opposed to serving a reference to a pre-initialized value. The reason is that the size of the struct is 1, and when we return via ref, it's returning a reference to the static value (so an IntPtr) which is of size 4 (x86 processor architecture), and size 8 (x64 processor architecture). So its makes much more sense to simply new() it.

This benchmark instantiates SpaceUnits via constructor and reference:

Method iterations Mean Error StdDev Allocated
ByCtor 10 2.703 ns 2.970 ns 0.1628 ns -
ByRef 10 4.001 ns 3.050 ns 0.1672 ns -
ByCtor 100 30.762 ns 9.106 ns 0.4991 ns -
ByRef 100 31.984 ns 1.688 ns 0.0925 ns -
ByCtor 1000 240.258 ns 6.619 ns 0.3628 ns -
ByRef 1000 241.926 ns 5.238 ns 0.2871 ns -
ByCtor 10000 2,336.375 ns 63.654 ns 3.4891 ns -
ByRef 10000 2,338.577 ns 159.218 ns 8.7273 ns -
ByCtor 100000 23,197.835 ns 2,682.852 ns 147.0562 ns -
ByRef 100000 23,286.836 ns 1,961.542 ns 107.5187 ns -

This benchmark instantiates SpaceUnits via constructor and reference, but also inserts them into an array of SpaceUnits:

Method iterations Mean Error StdDev Gen0 Gen1 Gen2 Allocated
ByCtor 10 8.286 ns 6.513 ns 0.3570 ns 0.0096 - - 40 B
ByRef 10 14.880 ns 3.227 ns 0.1769 ns 0.0095 - - 40 B
ByCtor 100 63.681 ns 3.227 ns 0.1769 ns 0.0305 - - 128 B
ByRef 100 138.383 ns 21.043 ns 1.1534 ns 0.0305 - - 128 B
ByCtor 1000 521.173 ns 82.105 ns 4.5004 ns 0.2441 - - 1024 B
ByRef 1000 1,452.452 ns 101.014 ns 5.5369 ns 0.2441 - - 1024 B
ByCtor 10000 5,019.518 ns 154.834 ns 8.4870 ns 2.3880 - - 10024 B
ByRef 10000 15,180.695 ns 663.576 ns 36.3728 ns 2.3804 - - 10024 B
ByCtor 100000 163,885.567 ns 6,346.882 ns 347.8940 ns 31.1279 31.1279 31.1279 100035 B
ByRef 100000 176,574.064 ns 7,297.200 ns 399.9841 ns 31.0059 31.0059 31.0059 100035 B