Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 122 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# To learn more about .editorconfig see https://aka.ms/editorconfigdocs
###############################
# Core EditorConfig Options #
###############################
# All files
[*]
indent_style = space
# Code files
[*.{cs,csx,vb,vbx}]
indent_size = 4
insert_final_newline = true
charset = utf-8-bom
###############################
# .NET Coding Conventions #
###############################
[*.{cs,vb}]
# Organize usings
dotnet_sort_system_directives_first = true
# this. preferences
dotnet_style_qualification_for_field = false:silent
dotnet_style_qualification_for_property = false:silent
dotnet_style_qualification_for_method = false:silent
dotnet_style_qualification_for_event = false:silent
# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
dotnet_style_predefined_type_for_member_access = true:silent
# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
dotnet_style_readonly_field = true:suggestion
# Expression-level preferences
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
# CSharp and Visual Basic code quality settings
dotnet_code_quality_unused_parameters = non_public:suggestion
###############################
# Naming Conventions #
###############################
# Style Definitions
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
# Use PascalCase for constant fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
dotnet_naming_symbols.constant_fields.required_modifiers = const
###############################
# C# Coding Conventions #
###############################
[*.cs]
# var preferences
csharp_style_var_for_built_in_types = true:silent
csharp_style_var_when_type_is_apparent = true:silent
csharp_style_var_elsewhere = true:silent
# Expression-bodied members
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
# Pattern matching preferences
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
# Null-checking preferences
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
# Modifier preferences
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
# Expression-level preferences
csharp_prefer_braces = true:silent
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_pattern_local_over_anonymous_function = true:suggestion
csharp_style_inlined_variable_declaration = true:silent
# Unused value preferences
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
csharp_style_unused_value_assignment_preference = unused_local_variable:suggestion
###############################
# C# Formatting Rules #
###############################
# New line preferences
csharp_new_line_before_open_brace = none
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true
# Indentation preferences
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = flush_left
# Space preferences
csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_around_binary_operators = before_and_after
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
# Wrapping preferences
csharp_preserve_single_line_statements = true
csharp_preserve_single_line_blocks = true
73 changes: 7 additions & 66 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,67 +1,8 @@
.vs/
packages/
TDigest.CMD/bin/
TDigest.CMD/obj/
TDigest.Tests/bin/
TDigest.Tests/obj/
TDigest/bin/
TDigest/obj/
Performance.psess
Report150613.vsp
TDigest.CMD.psess
TDigest.CMD/bin/Release/TDigest.CMD.vshost.exe
TDigest.CMD/bin/Release/TDigest.CMD.vshost.exe.config
TDigest.CMD/bin/Release/TDigest.CMD.vshost.exe.manifest
TDigest.CMD/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
TDigest.CMD/obj/Debug/TDigest.CMD.csproj.FileListAbsolute.txt
TDigest.CMD/obj/Debug/TDigest.CMD.csprojResolveAssemblyReference.cache
TDigest.CMD/obj/Debug/TDigest.CMD.exe
TDigest.CMD/obj/Debug/TDigest.CMD.instr.pdb
TDigest.CMD/obj/Debug/TDigest.CMD.pdb
TDigest.CMD/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
TDigest.CMD/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
TDigest.CMD/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
TDigest.CMD/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache
TDigest.CMD/obj/Release/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
TDigest.CMD/obj/Release/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
TDigest.CMD/obj/Release/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
TDigest.CMD150614.vspx
TDigest.Tests/bin/Debug/C5.dll
TDigest.Tests/bin/Debug/TDigest.dll
TDigest.Tests/bin/Debug/TDigest.pdb
TDigest.Tests/bin/Debug/TDigest.Tests.dll
TDigest.Tests/bin/Debug/TDigest.Tests.pdb
TDigest.Tests/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
TDigest.Tests/obj/Debug/TDigest.Tests.csproj.FileListAbsolute.txt
TDigest.Tests/obj/Debug/TDigest.Tests.csprojResolveAssemblyReference.cache
TDigest.Tests/obj/Debug/TDigest.Tests.dll
TDigest.Tests/obj/Debug/TDigest.Tests.pdb
TDigest.Tests/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
TDigest.Tests/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
TDigest.Tests/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
TDigest.Tests/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache
TDigest.Tests/obj/Release/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
TDigest.Tests/obj/Release/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
TDigest.Tests/obj/Release/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
TDigest.v12.suo
TDigest/bin/Debug/C5.dll
TDigest/bin/Debug/TDigest.dll
TDigest/bin/Debug/TDigest.dll.config
TDigest/bin/Debug/TDigest.instr.pdb
TDigest/bin/Debug/TDigest.pdb
TDigest/bin/Debug/TDigest.vshost.exe
TDigest/bin/Debug/TDigest.vshost.exe.config
TDigest/bin/Debug/TDigest.vshost.exe.manifest
TDigest/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
TDigest/obj/Debug/TDigest.csproj.FileListAbsolute.txt
TDigest/obj/Debug/TDigest.csprojResolveAssemblyReference.cache
TDigest/obj/Debug/TDigest.dll
TDigest/obj/Debug/TDigest.instr.pdb
TDigest/obj/Debug/TDigest.pdb
TDigest/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
TDigest/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
TDigest/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
TDigest/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache
TDigest/obj/Release/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
TDigest/obj/Release/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
TDigest/obj/Release/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
[Pp]ackages/
[Bb]in/
[Oo]bj/
*.psess
*.vsp
*.vspx
*.suo
40 changes: 40 additions & 0 deletions TDigest.Benchmarks/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Running;

namespace StatsLib.Benchmarks {
class Program {
static void Main() {
BenchmarkRunner.Run<SortedDigest>();
}
}

[SimpleJob(RuntimeMoniker.Net461)]
[MemoryDiagnoser]
public class SortedDigest {
[Params(1_000, 10_000, 100_000)]
public int N { get; set; }

[Params(true, false)]
public bool Asc { get; set; }

[Benchmark]
public double Build() {
TDigest digest = new TDigest();
double denominator = N;
for (int i = 0; i < N; ++i) {
// Add normalized values in interval [0.0, 1.0)
int numerator = Asc ? i : (N - i - 1);
digest.Add(numerator / denominator);
}

double count = digest.Count;
if (count != N) {
throw new InvalidOperationException($"Bad benchmark; digest.Count ({count}) != N ({N})");
}

return count;
}
}
}
17 changes: 17 additions & 0 deletions TDigest.Benchmarks/TDigest.Benchmarks.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net461</TargetFramework>
<Version>1.0.0</Version>
<Product>$(AssemblyName)</Product>
<Copyright>Copyright &#169; 2019</Copyright>
<IsPackable>false</IsPackable>
<DebugType>full</DebugType>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\TDigest\TDigest.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.12.0" />
</ItemGroup>
</Project>
5 changes: 1 addition & 4 deletions TDigest.CMD/Program.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StatsLib.CMD {
class Program {
static void Main(string[] args) {
static void Main() {
Random r = new Random();

TDigest digestA = new TDigest();
Expand Down
36 changes: 0 additions & 36 deletions TDigest.CMD/Properties/AssemblyInfo.cs

This file was deleted.

65 changes: 7 additions & 58 deletions TDigest.CMD/TDigest.CMD.csproj
Original file line number Diff line number Diff line change
@@ -1,64 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{9965BA5F-9FA3-46C3-BD89-ACF58D2887C8}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TDigest.CMD</RootNamespace>
<AssemblyName>TDigest.CMD</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFramework>net45</TargetFramework>
<Version>1.0.0</Version>
<Product>$(AssemblyName)</Product>
<Copyright>Copyright &#169; 2015</Copyright>
<IsPackable>false</IsPackable>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TDigest\TDigest.csproj">
<Project>{909364f5-4f9a-444d-be6a-ce2a6ef592b0}</Project>
<Name>TDigest</Name>
</ProjectReference>
<ProjectReference Include="..\TDigest\TDigest.csproj" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
Loading