Comments (3)
The first results are here:
https://github.com/dadhi/ImTools/blob/master/playground/ImTools.UnionCsVsFsBenchmarks/Program.fs
- Test sum of records as a more general case
- Lengthy collection to compare
- Compare vs
union.Match
- Sepate benchmark for collection creation
Remarks regarding F#:
- Type names like
val
,_
invalid in F# context - Sub-typed internal classes are not accessible
from imtools.
New naming proposal:
- All nested types are lowercase
- External types are single letter better not conflicting with something else
U2, U3, ..
for the unnamed unions
public abstract class Case<TName, T>
{
public readonly struct @case : I<T>, IEq<value>
{
public T Value { get; }
//...
}
}
public sealed class U2<A, B> : U<Empty, A, B> {}
public abstract class U<TName, A, B>
{
public interface union
{
R Match<A, B, R>(Func<A, R> fa...);
}
public readonly struct case1 : union, I<A>, IEq<case1>
{
public A Value { get; }
//...
}
}
from imtools.
Results:
BenchmarkDotNet=v0.12.0, OS=Windows 10.0.18362
Intel Core i7-8750H CPU 2.20GHz (Coffee Lake), 1 CPU, 12 logical and 6 physical cores
.NET Core SDK=3.0.100
[Host] : .NET Core 3.0.0 (CoreCLR 4.700.19.46205, CoreFX 4.700.19.46214), X64 RyuJIT DEBUG
DefaultJob : .NET Core 3.0.0 (CoreCLR 4.700.19.46205, CoreFX 4.700.19.46214), X64 RyuJIT
| Method | Mean | Error | StdDev | Ratio | RatioSD | Gen 0 | Gen 1 | Gen 2 | Allocated |
|------------------------------------------- |----------:|---------:|---------:|------:|--------:|-------:|------:|------:|----------:|
| FSharp | 12.49 ns | 0.031 ns | 0.029 ns | 1.00 | 0.00 | - | - | - | - |
| CSharp_named_case_struct | 15.43 ns | 0.085 ns | 0.080 ns | 1.24 | 0.01 | - | - | - | - |
| CSharp_named_case_struct_tag_match | 15.00 ns | 0.162 ns | 0.152 ns | 1.20 | 0.01 | - | - | - | - |
| CSharp_named_case_struct_match_I_interface | 248.44 ns | 4.045 ns | 3.784 ns | 19.89 | 0.29 | - | - | - | - |
| CSharp_named_case_struct_Match_method | 181.99 ns | 0.563 ns | 0.527 ns | 14.57 | 0.06 | 0.1733 | - | - | 816 B |
from imtools.
Related Issues (20)
- Improve memory use by more dedicated Branch types up to 3 level tree HOT 2
- Make using of ImTools concurrently with DryIoc HOT 13
- Try append-only hash-map as a tree stored in unrolled linked list HOT 1
- Try out 2-3-4 tree HOT 4
- Remove ImMap V1 from the benchmarks in readme and add ImMap234
- Add ImHashMap23 on par with ImMap23
- Add ImMap.GetSurePresentValue method
- Replace the ImMap methods with Update delegate parameter with composable Add and Update methods
- Add a builder-like capability to the ImHashMap via BuildFromDifferent methods HOT 2
- Add the ImHashMap creation methods to accept the array of items and immediately build the final form of the map HOT 1
- Implement native ToJson and fromJson for maps HOT 1
- the Im(Hash)Map.Entry methods should return the entry type but now return the map type HOT 1
- Document Im(Hash)Map implementation quirks and tricks for the future presentation
- Try struct instead of array for PartitionedImMap HOT 1
- Add output of the ImHashMap as mermaid diagram HOT 1
- Merge the ImMap and ImHashMap implementations
- Optimize Enumerable for the PartitionedHashMap
- Reduce ImHashMap memory allocations keeping the speed
- Add AddSureNotPresent methods to compensate for GetSurePresent methods
- Optimize the case of split B2 to B3 when B2 other leaf still accommodate the Entry
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imtools.