Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2.0 #86

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open

V2.0 #86

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
2d57a67
Reorganize project, introduce dependency from spec.
aensidhe Oct 7, 2018
fa122b3
Introduce Formatter and Parser interfaces.
aensidhe Oct 13, 2018
5e862e4
Change BoolConverter to new interfaces
aensidhe Oct 13, 2018
2d978f6
BinaryConverter converted to 2.0
aensidhe Nov 10, 2018
f5dba60
NullableConverter moved to new interfaces.
aensidhe Nov 10, 2018
a6c9a05
Arrays are done.
aensidhe Nov 14, 2018
b7d64a9
Binary structure adjusted
aensidhe Nov 14, 2018
3b4bcaf
Convert DateTimeConverter
aensidhe Nov 15, 2018
05e0816
Add enum string parser and formatter
aensidhe Nov 16, 2018
28f563e
Add map and readonlymap formatter and parsers
aensidhe Nov 16, 2018
dacbf8f
Add TimeSpan format and parsing capabilities, remove unused code
aensidhe Nov 16, 2018
cb09a47
Add string formatter and parser
aensidhe Nov 16, 2018
b19d679
Cleaning up for MVP
aensidhe Nov 16, 2018
153d169
Move "DateTimeUtils" into Ticks.
aensidhe Nov 16, 2018
cf34e91
Add number formatter and parser
aensidhe Nov 17, 2018
78535ac
Use GetRequiredFormatter and GetRequiredParser.
aensidhe Nov 17, 2018
7d5f2c2
Fix array formatters
aensidhe Nov 17, 2018
fa70866
It compiles!
aensidhe Nov 17, 2018
a42f692
Tests compiled
aensidhe Nov 17, 2018
f9ddbf4
Reading tests are passed.
aensidhe Nov 17, 2018
7ac4f11
Fix writing
aensidhe Nov 17, 2018
2ff6258
Fix benchmark
aensidhe Nov 18, 2018
f4ae5ff
I need it to compile on azure
aensidhe Nov 18, 2018
c7f80a8
Generic mappers.
aensidhe Nov 19, 2018
0350b6b
Fix bug in List.Parser
aensidhe Nov 20, 2018
ebf0b79
ReadOnlySequence
aensidhe Jan 13, 2019
3ab0bae
Adjust project structure.
aensidhe Jan 13, 2019
38f1ac5
Remove AssemblyInfo.cs
aensidhe Jan 13, 2019
a0539dd
Methods for registering IMsgPackSequenceParser.
aensidhe Jan 17, 2019
338aad4
Separate cache for _genericSequenceParsers
aensidhe Jan 17, 2019
7d7e83d
deps: update deps
aensidhe Feb 2, 2019
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
144 changes: 144 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# examples are here: http://editorconfig.org/
root = true

[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
charset = utf-8

[*.{yml,yaml,csproj}]
indent_size = 2

[*.cs]
# .NET Code Style Settings
## Use this or not
dotnet_style_qualification_for_field = false:error
dotnet_style_qualification_for_property = false:error
dotnet_style_qualification_for_method = false:error
dotnet_style_qualification_for_event = false:error

## use int or Int32
dotnet_style_predefined_type_for_locals_parameters_members = true:error
dotnet_style_predefined_type_for_member_access = true:error

## Modifier preferences
dotnet_style_require_accessibility_modifiers = always:error
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:error
dotnet_style_readonly_field = true:error

## use of object initializers, collection initializers, explicit tuple names
dotnet_style_object_initializer = true:error
dotnet_style_collection_initializer = true:error
dotnet_style_explicit_tuple_names = true:error
dotnet_prefer_inferred_tuple_names = true:error
dotnet_prefer_inferred_anonymous_type_member_names = true:error

## "Null" checking preferences
dotnet_style_coalesce_expression = true:error
dotnet_style_null_propagation = true:error

## to var or not to var
csharp_style_var_for_built_in_types = true:error
csharp_style_var_when_type_is_apparent = true:error
csharp_style_var_elsewhere = true:error

## => for bodies or not
csharp_style_expression_bodied_methods = when_on_single_line:error
csharp_style_expression_bodied_constructors = when_on_single_line:error
csharp_style_expression_bodied_operators = when_on_single_line:error
csharp_style_expression_bodied_properties = when_on_single_line:error
csharp_style_expression_bodied_indexers = when_on_single_line:error
csharp_style_expression_bodied_accessors = when_on_single_line:error

## pattern matching
csharp_style_pattern_matching_over_is_with_cast_check = true:error
csharp_style_pattern_matching_over_as_with_null_check = true:error
csharp_style_inlined_variable_declaration = true:error

## default expressions, deconstructed variables, and local functions over anonymous functions.
csharp_prefer_simple_default_expression = true:error
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_pattern_local_over_anonymous_function = true:suggestion

## null check
csharp_style_throw_expression = true:error
csharp_style_conditional_delegate_call = true:error

## braces around one liner
csharp_prefer_braces = false:suggestion

# .NET formatting settings
## Organize usings
dotnet_sort_system_directives_first = true

## Newline Options
csharp_new_line_before_open_brace = all
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 options
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = one_less_than_current

## Spacing Options
csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_parentheses = false

## Wrapping options

csharp_preserve_single_line_statements = true
csharp_preserve_single_line_blocks = true

# Naming style

## Source: https://github.com/kentcb/EditorConfigReference/blob/master/.editorconfig
dotnet_naming_symbols.private_field_symbol.applicable_kinds = field
dotnet_naming_symbols.private_field_symbol.applicable_accessibilities = private
dotnet_naming_style.private_field_style.required_prefix = _
dotnet_naming_style.private_field_style.capitalization = camel_case
dotnet_naming_rule.private_fields_are_camel_case.severity = error
dotnet_naming_rule.private_fields_are_camel_case.symbols = private_field_symbol
dotnet_naming_rule.private_fields_are_camel_case.style = private_field_style

dotnet_naming_symbols.non_private_field_symbol.applicable_kinds = field
dotnet_naming_symbols.non_private_field_symbol.applicable_accessibilities = public,internal,friend,protected,protected_internal,protected_friend
dotnet_naming_style.non_private_field_style.capitalization = pascal_case
dotnet_naming_rule.non_private_fields_are_pascal_case.severity = error
dotnet_naming_rule.non_private_fields_are_pascal_case.symbols = non_private_field_symbol
dotnet_naming_rule.non_private_fields_are_pascal_case.style = non_private_field_style

dotnet_naming_symbols.parameter_symbol.applicable_kinds = parameter
dotnet_naming_style.parameter_style.capitalization = camel_case
dotnet_naming_rule.parameters_are_camel_case.severity = error
dotnet_naming_rule.parameters_are_camel_case.symbols = parameter_symbol
dotnet_naming_rule.parameters_are_camel_case.style = parameter_style

dotnet_naming_symbols.non_interface_type_symbol.applicable_kinds = class,struct,enum,delegate
dotnet_naming_style.non_interface_type_style.capitalization = pascal_case
dotnet_naming_rule.non_interface_types_are_pascal_case.severity = error
dotnet_naming_rule.non_interface_types_are_pascal_case.symbols = non_interface_type_symbol
dotnet_naming_rule.non_interface_types_are_pascal_case.style = non_interface_type_style

dotnet_naming_symbols.interface_type_symbol.applicable_kinds = interface
dotnet_naming_style.interface_type_style.capitalization = pascal_case
dotnet_naming_style.interface_type_style.required_prefix = I
dotnet_naming_rule.interface_types_must_be_prefixed_with_I.severity = error
dotnet_naming_rule.interface_types_must_be_prefixed_with_I.symbols = interface_type_symbol
dotnet_naming_rule.interface_types_must_be_prefixed_with_I.style = interface_type_style

dotnet_naming_symbols.member_symbol.applicable_kinds = method,property,event
dotnet_naming_style.member_style.capitalization = pascal_case
dotnet_naming_rule.members_are_pascal_case.severity = error
dotnet_naming_rule.members_are_pascal_case.symbols = member_symbol
dotnet_naming_rule.members_are_pascal_case.style = member_style
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ Release
bin
obj
/.vs

**/BenchmarkDotNet.Artifacts/
56 changes: 11 additions & 45 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,13 @@
jobs:
- job: macOs
pool:
name: Hosted macOS
steps:
- template: .azure/tests.yml

- job: linux
pool:
name: Hosted Ubuntu 1604
steps:
- script: curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin -channel 1.1
displayName: Installing .netcore 1.1
- template: .azure/tests.yml
parameters:
netcore1Global: false

- job: win
dependsOn:
- macOs
- linux
pool:
name: Hosted VS2017
steps:
- template: .azure/tests.yml
variables:
sln: msgpack.sln
tests: tests/msgpack.light.tests/msgpack.light.tests.csproj

- task: PowerShell@2
displayName: pack nuget package
inputs:
targetType: inline
script: |
$version = $(git describe --tags | %{$_ -replace '-([^g])', '.$1'})
dotnet pack --no-build -v minimal -c Release /property:Version=$version /property:PackageOutputPath=$(Build.ArtifactStagingDirectory)
resources:
repositories:
- repository: templates
type: github
name: progaudi/azure-pipelines
endpoint: progaudi

- ${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
- task: NuGetCommand@2
displayName: push nuget packages
inputs:
command: push
packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
nuGetFeedType: external
publishFeedCredentials: api.nuget.org

- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: .nupkgs
jobs:
- template: library/nuget.yml@templates
8 changes: 1 addition & 7 deletions msgpack.sln
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.10
MinimumVisualStudioVersion = 10.0.40219.1
Expand All @@ -12,8 +12,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "msgpack.light", "src\msgpac
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "msgpack.light.tests", "tests\msgpack.light.tests\msgpack.light.tests.csproj", "{4DD9051D-548F-4E11-86EA-746F443CEA67}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "msgpack.light.benchmark", "src\msgpack.light.benchmark\msgpack.light.benchmark.csproj", "{62C5CC43-A029-4529-BBCA-6D8CC69E6B11}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -28,10 +26,6 @@ Global
{4DD9051D-548F-4E11-86EA-746F443CEA67}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4DD9051D-548F-4E11-86EA-746F443CEA67}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4DD9051D-548F-4E11-86EA-746F443CEA67}.Release|Any CPU.Build.0 = Release|Any CPU
{62C5CC43-A029-4529-BBCA-6D8CC69E6B11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{62C5CC43-A029-4529-BBCA-6D8CC69E6B11}.Debug|Any CPU.Build.0 = Debug|Any CPU
{62C5CC43-A029-4529-BBCA-6D8CC69E6B11}.Release|Any CPU.ActiveCfg = Release|Any CPU
{62C5CC43-A029-4529-BBCA-6D8CC69E6B11}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
1 change: 1 addition & 0 deletions msgpack.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpRenamePlacementToArrangementMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
Expand Down
71 changes: 25 additions & 46 deletions src/msgpack.light.benchmark/BeerDeserializeBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,91 +41,70 @@ private MemoryStream PrepareJson(BeerSerializeBenchmark serializer)
}

[Benchmark]
public void JsonNet()
public object JsonNet()
{
_json.Seek(0, SeekOrigin.Begin);
using (var reader = new StreamReader(_json, Encoding.UTF8, false, 1024, true))
{
var beer = Serializers.Newtonsoft.Deserialize(reader, typeof(Beer));
return Serializers.Newtonsoft.Deserialize(reader, typeof(Beer));
}
}

[Benchmark(Baseline = true)]
public void MPCli_Stream()
public Beer MPCli_Stream()
{
_msgPack.Seek(0, SeekOrigin.Begin);
var beer = Serializers.MsgPack.GetSerializer<Beer>().Unpack(_msgPack);
return Serializers.MsgPack.GetSerializer<Beer>().Unpack(_msgPack);
}

[Benchmark]
public void MPCli_Array()
public Beer MPCli_Array()
{
var beer = Serializers.MsgPack.GetSerializer<Beer>().UnpackSingleObject(_msgPackArray);
return Serializers.MsgPack.GetSerializer<Beer>().UnpackSingleObject(_msgPackArray);
}

[Benchmark]
public void MPSharp_Stream()
public Beer MPSharp_Stream()
{
_msgPack.Seek(0, SeekOrigin.Begin);
var beer = MessagePackSerializer.Deserialize<Beer>(_msgPack);
}

[Benchmark]
public void MPSharp_Array()
{
var beer = MessagePackSerializer.Deserialize<Beer>(_msgPackArray);
return MessagePackSerializer.Deserialize<Beer>(_msgPack);
}

[Benchmark]
public void MPLight_Stream()
public Beer MPSharp_Array()
{
_msgPack.Seek(0, SeekOrigin.Begin);
var beer = MsgPackSerializer.Deserialize<Beer>(_msgPack, Serializers.MsgPackLight);
return MessagePackSerializer.Deserialize<Beer>(_msgPackArray);
}

[Benchmark]
public void MPLight_Array()
public Beer MPLight_Array()
{
var beer = MsgPackSerializer.Deserialize<Beer>(_msgPackArray, Serializers.MsgPackLight);
return MsgPackSerializer.Deserialize<Beer>(_msgPackArray, Serializers.MsgPackLight);
}

[Benchmark]
public void MPCliH_Stream()
public Beer MPCliH_Stream()
{
_msgPack.Seek(0, SeekOrigin.Begin);
var beer = Serializers.MsgPackHardcore.GetSerializer<Beer>().Unpack(_msgPack);
return Serializers.MsgPackHardcore.GetSerializer<Beer>().Unpack(_msgPack);
}

[Benchmark]
public void MPCliH_Array()
public Beer MPCliH_Array()
{
var beer = Serializers.MsgPackHardcore.GetSerializer<Beer>().UnpackSingleObject(_msgPackArray);
return Serializers.MsgPackHardcore.GetSerializer<Beer>().UnpackSingleObject(_msgPackArray);
}

[Benchmark]
public void MPLightH_Stream()
public Beer MPLightH_Array()
{
_msgPack.Seek(0, SeekOrigin.Begin);
var beer = MsgPackSerializer.Deserialize<Beer>(_msgPack, Serializers.MsgPackLightHardcore);
return MsgPackSerializer.Deserialize<Beer>(_msgPackArray, Serializers.MsgPackLightHardcore, out _);
}

[Benchmark]
public void MPLightH_Array()
{
var beer = MsgPackSerializer.Deserialize<Beer>(_msgPackArray, Serializers.MsgPackLightHardcore);
}

[Benchmark]
public void MPLightH_Stream_AutoMap()
{
_msgPack.Seek(0, SeekOrigin.Begin);
var beer = MsgPackSerializer.Deserialize<Beer>(_msgPack, Serializers.MsgPackLightMapAutoGeneration);
}

[Benchmark]
public void MPLightH_Array_AutoMap()
{
var beer = MsgPackSerializer.Deserialize<Beer>(_msgPackArray, Serializers.MsgPackLightMapAutoGeneration);
}
// [Benchmark]
// public void MPLightH_Array_AutoMap()
// {
// var beer = MsgPackSerializer.Deserialize<Beer>(_msgPackArray, Serializers.MsgPackLightMapAutoGeneration);
// }
}
}
}
Loading