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

No unsafe #343

Merged
merged 5 commits into from
Oct 7, 2017
Merged

No unsafe #343

merged 5 commits into from
Oct 7, 2017

Conversation

awalterschulze
Copy link
Member

Using encoding/binary to encode and decode fixed64 and fixed32 values.

Here we show that unsafe is not much faster than a byte by byte copy, if we add a range check hint
https://github.com/awalterschulze/gorangecheck

Thank you @diamondo25 for reporting this issue
#333

@awalterschulze
Copy link
Member Author

$benchcmp ./test/mixbench/unsafe_unmarshaler.txt ./test/mixbench/unmarshaler.txt
benchmark                                                                   old ns/op     new ns/op     delta
BenchmarkNidOptNativeProtoUnmarshal-8                                       425           437           +2.82%
BenchmarkNinOptNativeProtoUnmarshal-8                                       612           648           +5.88%
BenchmarkNidRepNativeProtoUnmarshal-8                                       2884          2864          -0.69%
BenchmarkNinRepNativeProtoUnmarshal-8                                       2809          2820          +0.39%
BenchmarkNidRepPackedNativeProtoUnmarshal-8                                 1806          1801          -0.28%
BenchmarkNinRepPackedNativeProtoUnmarshal-8                                 1769          1813          +2.49%
BenchmarkNidOptStructProtoUnmarshal-8                                       1820          1839          +1.04%
BenchmarkNinOptStructProtoUnmarshal-8                                       1932          2018          +4.45%
BenchmarkNidRepStructProtoUnmarshal-8                                       5074          5149          +1.48%
BenchmarkNinRepStructProtoUnmarshal-8                                       4891          5018          +2.60%
BenchmarkNidEmbeddedStructProtoUnmarshal-8                                  1034          1065          +3.00%
BenchmarkNinEmbeddedStructProtoUnmarshal-8                                  1061          1079          +1.70%
BenchmarkNidNestedStructProtoUnmarshal-8                                    11579         11788         +1.80%
BenchmarkNinNestedStructProtoUnmarshal-8                                    10862         11113         +2.31%
BenchmarkNidOptCustomProtoUnmarshal-8                                       202           199           -1.49%
BenchmarkCustomDashProtoUnmarshal-8                                         228           228           +0.00%
BenchmarkNinOptCustomProtoUnmarshal-8                                       245           246           +0.41%
BenchmarkNidRepCustomProtoUnmarshal-8                                       810           801           -1.11%
BenchmarkNinRepCustomProtoUnmarshal-8                                       812           810           -0.25%
BenchmarkNinOptNativeUnionProtoUnmarshal-8                                  73.2          80.9          +10.52%
BenchmarkNinOptStructUnionProtoUnmarshal-8                                  194           201           +3.61%
BenchmarkNinEmbeddedStructUnionProtoUnmarshal-8                             459           460           +0.22%
BenchmarkNinNestedStructUnionProtoUnmarshal-8                               315           318           +0.95%
BenchmarkTreeProtoUnmarshal-8                                               307           308           +0.33%
BenchmarkOrBranchProtoUnmarshal-8                                           782           801           +2.43%
BenchmarkAndBranchProtoUnmarshal-8                                          776           786           +1.29%
BenchmarkLeafProtoUnmarshal-8                                               218           221           +1.38%
BenchmarkDeepTreeProtoUnmarshal-8                                           565           564           -0.18%
BenchmarkADeepBranchProtoUnmarshal-8                                        734           734           +0.00%
BenchmarkAndDeepBranchProtoUnmarshal-8                                      1263          1259          -0.32%
BenchmarkDeepLeafProtoUnmarshal-8                                           476           473           -0.63%
BenchmarkNilProtoUnmarshal-8                                                137           138           +0.73%
BenchmarkNidOptEnumProtoUnmarshal-8                                         141           143           +1.42%
BenchmarkNinOptEnumProtoUnmarshal-8                                         200           203           +1.50%
BenchmarkNidRepEnumProtoUnmarshal-8                                         449           461           +2.67%
BenchmarkNinRepEnumProtoUnmarshal-8                                         459           445           -3.05%
BenchmarkNinOptEnumDefaultProtoUnmarshal-8                                  203           199           -1.97%
BenchmarkAnotherNinOptEnumProtoUnmarshal-8                                  201           199           -1.00%
BenchmarkAnotherNinOptEnumDefaultProtoUnmarshal-8                           205           203           -0.98%
BenchmarkTimerProtoUnmarshal-8                                              223           224           +0.45%
BenchmarkMyExtendableProtoUnmarshal-8                                       654           653           -0.15%
BenchmarkOtherExtenableProtoUnmarshal-8                                     1353          1349          -0.30%
BenchmarkNestedDefinitionProtoUnmarshal-8                                   919           936           +1.85%
BenchmarkNestedDefinition_NestedMessageProtoUnmarshal-8                     427           421           -1.41%
BenchmarkNestedDefinition_NestedMessage_NestedNestedMsgProtoUnmarshal-8     216           224           +3.70%
BenchmarkNestedScopeProtoUnmarshal-8                                        893           918           +2.80%
BenchmarkNinOptNativeDefaultProtoUnmarshal-8                                671           663           -1.19%
BenchmarkCustomContainerProtoUnmarshal-8                                    351           360           +2.56%
BenchmarkCustomNameNidOptNativeProtoUnmarshal-8                             446           455           +2.02%
BenchmarkCustomNameNinOptNativeProtoUnmarshal-8                             652           667           +2.30%
BenchmarkCustomNameNinRepNativeProtoUnmarshal-8                             2841          2908          +2.36%
BenchmarkCustomNameNinStructProtoUnmarshal-8                                2639          2668          +1.10%
BenchmarkCustomNameCustomTypeProtoUnmarshal-8                               919           926           +0.76%
BenchmarkCustomNameNinEmbeddedStructUnionProtoUnmarshal-8                   461           471           +2.17%
BenchmarkCustomNameEnumProtoUnmarshal-8                                     270           267           -1.11%
BenchmarkNoExtensionsMapProtoUnmarshal-8                                    353           341           -3.40%
BenchmarkUnrecognizedProtoUnmarshal-8                                       85.7          85.0          -0.82%
BenchmarkUnrecognizedWithInnerProtoUnmarshal-8                              415           408           -1.69%
BenchmarkUnrecognizedWithInner_InnerProtoUnmarshal-8                        42.6          45.5          +6.81%
BenchmarkUnrecognizedWithEmbedProtoUnmarshal-8                              259           261           +0.77%
BenchmarkUnrecognizedWithEmbed_EmbeddedProtoUnmarshal-8                     43.2          43.2          +0.00%
BenchmarkNodeProtoUnmarshal-8                                               306           310           +1.31%
BenchmarkNonByteCustomTypeProtoUnmarshal-8                                  308           310           +0.65%
BenchmarkNidOptNonByteCustomTypeProtoUnmarshal-8                            292           294           +0.68%
BenchmarkNinOptNonByteCustomTypeProtoUnmarshal-8                            306           308           +0.65%
BenchmarkNidRepNonByteCustomTypeProtoUnmarshal-8                            1049          1040          -0.86%
BenchmarkNinRepNonByteCustomTypeProtoUnmarshal-8                            1046          1039          -0.67%
BenchmarkProtoTypeProtoUnmarshal-8                                          221           220           -0.45%

benchmark                                                                   old MB/s     new MB/s     speedup
BenchmarkNidOptNativeProtoUnmarshal-8                                       540.14       525.94       0.97x
BenchmarkNinOptNativeProtoUnmarshal-8                                       341.01       322.37       0.95x
BenchmarkNidRepNativeProtoUnmarshal-8                                       283.98       285.90       1.01x
BenchmarkNinRepNativeProtoUnmarshal-8                                       291.49       290.41       1.00x
BenchmarkNidRepPackedNativeProtoUnmarshal-8                                 206.53       207.09       1.00x
BenchmarkNinRepPackedNativeProtoUnmarshal-8                                 210.78       205.70       0.98x
BenchmarkNidOptStructProtoUnmarshal-8                                       464.71       459.88       0.99x
BenchmarkNinOptStructProtoUnmarshal-8                                       396.30       379.50       0.96x
BenchmarkNidRepStructProtoUnmarshal-8                                       349.42       344.29       0.99x
BenchmarkNinRepStructProtoUnmarshal-8                                       362.49       353.26       0.97x
BenchmarkNidEmbeddedStructProtoUnmarshal-8                                  466.75       453.50       0.97x
BenchmarkNinEmbeddedStructProtoUnmarshal-8                                  431.37       424.46       0.98x
BenchmarkNidNestedStructProtoUnmarshal-8                                    356.66       350.34       0.98x
BenchmarkNinNestedStructProtoUnmarshal-8                                    358.12       350.03       0.98x
BenchmarkNidOptCustomProtoUnmarshal-8                                       350.76       355.77       1.01x
BenchmarkCustomDashProtoUnmarshal-8                                         358.70       359.40       1.00x
BenchmarkNinOptCustomProtoUnmarshal-8                                       272.41       271.79       1.00x
BenchmarkNidRepCustomProtoUnmarshal-8                                       224.66       227.02       1.01x
BenchmarkNinRepCustomProtoUnmarshal-8                                       224.11       224.64       1.00x
BenchmarkNinOptNativeUnionProtoUnmarshal-8                                  218.58       197.77       0.90x
BenchmarkNinOptStructUnionProtoUnmarshal-8                                  323.57       311.92       0.96x
BenchmarkNinEmbeddedStructUnionProtoUnmarshal-8                             324.42       323.74       1.00x
BenchmarkNinNestedStructUnionProtoUnmarshal-8                               247.13       245.16       0.99x
BenchmarkTreeProtoUnmarshal-8                                               335.37       333.66       0.99x
BenchmarkOrBranchProtoUnmarshal-8                                           313.01       305.77       0.98x
BenchmarkAndBranchProtoUnmarshal-8                                          315.38       311.55       0.99x
BenchmarkLeafProtoUnmarshal-8                                               443.71       437.02       0.98x
BenchmarkDeepTreeProtoUnmarshal-8                                           256.61       256.77       1.00x
BenchmarkADeepBranchProtoUnmarshal-8                                        249.27       249.07       1.00x
BenchmarkAndDeepBranchProtoUnmarshal-8                                      262.80       263.56       1.00x
BenchmarkDeepLeafProtoUnmarshal-8                                           294.03       295.86       1.01x
BenchmarkNilProtoUnmarshal-8                                                254.01       252.17       0.99x
BenchmarkNidOptEnumProtoUnmarshal-8                                         260.58       258.45       0.99x
BenchmarkNinOptEnumProtoUnmarshal-8                                         204.30       201.75       0.99x
BenchmarkNidRepEnumProtoUnmarshal-8                                         131.35       127.85       0.97x
BenchmarkNinRepEnumProtoUnmarshal-8                                         128.30       132.38       1.03x
BenchmarkNinOptEnumDefaultProtoUnmarshal-8                                  201.59       205.22       1.02x
BenchmarkAnotherNinOptEnumProtoUnmarshal-8                                  203.75       205.47       1.01x
BenchmarkAnotherNinOptEnumDefaultProtoUnmarshal-8                           199.16       201.78       1.01x
BenchmarkTimerProtoUnmarshal-8                                              469.62       468.19       1.00x
BenchmarkMyExtendableProtoUnmarshal-8                                       123.72       123.97       1.00x
BenchmarkOtherExtenableProtoUnmarshal-8                                     116.72       117.08       1.00x
BenchmarkNestedDefinitionProtoUnmarshal-8                                   252.43       247.70       0.98x
BenchmarkNestedDefinition_NestedMessageProtoUnmarshal-8                     278.50       282.31       1.01x
BenchmarkNestedDefinition_NestedMessage_NestedNestedMsgProtoUnmarshal-8     378.01       364.55       0.96x
BenchmarkNestedScopeProtoUnmarshal-8                                        249.72       242.79       0.97x
BenchmarkNinOptNativeDefaultProtoUnmarshal-8                                311.36       315.02       1.01x
BenchmarkCustomContainerProtoUnmarshal-8                                    310.13       302.50       0.98x
BenchmarkCustomNameNidOptNativeProtoUnmarshal-8                             514.92       504.73       0.98x
BenchmarkCustomNameNinOptNativeProtoUnmarshal-8                             320.55       313.20       0.98x
BenchmarkCustomNameNinRepNativeProtoUnmarshal-8                             288.23       281.59       0.98x
BenchmarkCustomNameNinStructProtoUnmarshal-8                                363.30       359.44       0.99x
BenchmarkCustomNameCustomTypeProtoUnmarshal-8                               232.73       231.07       0.99x
BenchmarkCustomNameNinEmbeddedStructUnionProtoUnmarshal-8                   322.60       316.30       0.98x
BenchmarkCustomNameEnumProtoUnmarshal-8                                     166.20       168.48       1.01x
BenchmarkNoExtensionsMapProtoUnmarshal-8                                    228.99       237.47       1.04x
BenchmarkUnrecognizedProtoUnmarshal-8                                       525.21       529.53       1.01x
BenchmarkUnrecognizedWithInnerProtoUnmarshal-8                              226.40       230.38       1.02x
BenchmarkUnrecognizedWithInner_InnerProtoUnmarshal-8                        117.47       109.87       0.94x
BenchmarkUnrecognizedWithEmbedProtoUnmarshal-8                              343.44       340.78       0.99x
BenchmarkUnrecognizedWithEmbed_EmbeddedProtoUnmarshal-8                     115.84       115.70       1.00x
BenchmarkNodeProtoUnmarshal-8                                               329.03       325.74       0.99x
BenchmarkNonByteCustomTypeProtoUnmarshal-8                                  256.11       254.37       0.99x
BenchmarkNidOptNonByteCustomTypeProtoUnmarshal-8                            284.10       281.53       0.99x
BenchmarkNinOptNonByteCustomTypeProtoUnmarshal-8                            258.01       256.49       0.99x
BenchmarkNidRepNonByteCustomTypeProtoUnmarshal-8                            219.19       221.03       1.01x
BenchmarkNinRepNonByteCustomTypeProtoUnmarshal-8                            219.68       221.20       1.01x
BenchmarkProtoTypeProtoUnmarshal-8                                          370.99       372.18       1.00x

@awalterschulze
Copy link
Member Author

$ benchcmp ./test/mixbench/unsafe_marshaler.txt ./test/mixbench/marshaler.txt
benchmark                                                                 old ns/op     new ns/op     delta
BenchmarkNidOptNativeProtoMarshal-8                                       235           240           +2.13%
BenchmarkNinOptNativeProtoMarshal-8                                       265           277           +4.53%
BenchmarkNidRepNativeProtoMarshal-8                                       1011          1074          +6.23%
BenchmarkNinRepNativeProtoMarshal-8                                       1004          1065          +6.08%
BenchmarkNidRepPackedNativeProtoMarshal-8                                 958           1033          +7.83%
BenchmarkNinRepPackedNativeProtoMarshal-8                                 968           1018          +5.17%
BenchmarkNidOptStructProtoMarshal-8                                       979           1024          +4.60%
BenchmarkNinOptStructProtoMarshal-8                                       946           974           +2.96%
BenchmarkNidRepStructProtoMarshal-8                                       2495          2593          +3.93%
BenchmarkNinRepStructProtoMarshal-8                                       2265          2443          +7.86%
BenchmarkNidEmbeddedStructProtoMarshal-8                                  561           582           +3.74%
BenchmarkNinEmbeddedStructProtoMarshal-8                                  538           557           +3.53%
BenchmarkNidNestedStructProtoMarshal-8                                    7308          7862          +7.58%
BenchmarkNinNestedStructProtoMarshal-8                                    6016          6228          +3.52%
BenchmarkNidOptCustomProtoMarshal-8                                       97.3          95.1          -2.26%
BenchmarkCustomDashProtoMarshal-8                                         92.5          92.5          +0.00%
BenchmarkNinOptCustomProtoMarshal-8                                       97.4          96.2          -1.23%
BenchmarkNidRepCustomProtoMarshal-8                                       258           258           +0.00%
BenchmarkNinRepCustomProtoMarshal-8                                       258           267           +3.49%
BenchmarkNinOptNativeUnionProtoMarshal-8                                  69.0          68.8          -0.29%
BenchmarkNinOptStructUnionProtoMarshal-8                                  138           137           -0.72%
BenchmarkNinEmbeddedStructUnionProtoMarshal-8                             251           259           +3.19%
BenchmarkNinNestedStructUnionProtoMarshal-8                               208           212           +1.92%
BenchmarkTreeProtoMarshal-8                                               154           154           +0.00%
BenchmarkOrBranchProtoMarshal-8                                           343           353           +2.92%
BenchmarkAndBranchProtoMarshal-8                                          344           348           +1.16%
BenchmarkLeafProtoMarshal-8                                               117           118           +0.85%
BenchmarkDeepTreeProtoMarshal-8                                           247           251           +1.62%
BenchmarkADeepBranchProtoMarshal-8                                        301           308           +2.33%
BenchmarkAndDeepBranchProtoMarshal-8                                      595           604           +1.51%
BenchmarkDeepLeafProtoMarshal-8                                           206           213           +3.40%
BenchmarkNilProtoMarshal-8                                                51.2          50.1          -2.15%
BenchmarkNidOptEnumProtoMarshal-8                                         62.0          61.7          -0.48%
BenchmarkNinOptEnumProtoMarshal-8                                         78.6          77.8          -1.02%
BenchmarkNidRepEnumProtoMarshal-8                                         184           186           +1.09%
BenchmarkNinRepEnumProtoMarshal-8                                         184           183           -0.54%
BenchmarkNinOptEnumDefaultProtoMarshal-8                                  78.1          77.9          -0.26%
BenchmarkAnotherNinOptEnumProtoMarshal-8                                  77.6          78.9          +1.68%
BenchmarkAnotherNinOptEnumDefaultProtoMarshal-8                           79.1          78.6          -0.63%
BenchmarkTimerProtoMarshal-8                                              103           103           +0.00%
BenchmarkMyExtendableProtoMarshal-8                                       465           515           +10.75%
BenchmarkOtherExtenableProtoMarshal-8                                     1028          1000          -2.72%
BenchmarkNestedDefinitionProtoMarshal-8                                   283           285           +0.71%
BenchmarkNestedDefinition_NestedMessageProtoMarshal-8                     141           142           +0.71%
BenchmarkNestedDefinition_NestedMessage_NestedNestedMsgProtoMarshal-8     94.1          93.3          -0.85%
BenchmarkNestedScopeProtoMarshal-8                                        259           260           +0.39%
BenchmarkNinOptNativeDefaultProtoMarshal-8                                272           277           +1.84%
BenchmarkCustomContainerProtoMarshal-8                                    141           141           +0.00%
BenchmarkCustomNameNidOptNativeProtoMarshal-8                             237           242           +2.11%
BenchmarkCustomNameNinOptNativeProtoMarshal-8                             290           276           -4.83%
BenchmarkCustomNameNinRepNativeProtoMarshal-8                             1006          1043          +3.68%
BenchmarkCustomNameNinStructProtoMarshal-8                                1296          1294          -0.15%
BenchmarkCustomNameCustomTypeProtoMarshal-8                               300           298           -0.67%
BenchmarkCustomNameNinEmbeddedStructUnionProtoMarshal-8                   247           255           +3.24%
BenchmarkCustomNameEnumProtoMarshal-8                                     107           102           -4.67%
BenchmarkNoExtensionsMapProtoMarshal-8                                    116           118           +1.72%
BenchmarkUnrecognizedProtoMarshal-8                                       66.8          66.4          -0.60%
BenchmarkUnrecognizedWithInnerProtoMarshal-8                              171           168           -1.75%
BenchmarkUnrecognizedWithInner_InnerProtoMarshal-8                        46.7          43.4          -7.07%
BenchmarkUnrecognizedWithEmbedProtoMarshal-8                              126           126           +0.00%
BenchmarkUnrecognizedWithEmbed_EmbeddedProtoMarshal-8                     43.8          43.7          -0.23%
BenchmarkNodeProtoMarshal-8                                               119           121           +1.68%
BenchmarkNonByteCustomTypeProtoMarshal-8                                  123           123           +0.00%
BenchmarkNidOptNonByteCustomTypeProtoMarshal-8                            126           130           +3.17%
BenchmarkNinOptNonByteCustomTypeProtoMarshal-8                            123           124           +0.81%
BenchmarkNidRepNonByteCustomTypeProtoMarshal-8                            386           387           +0.26%
BenchmarkNinRepNonByteCustomTypeProtoMarshal-8                            382           390           +2.09%
BenchmarkProtoTypeProtoMarshal-8                                          94.3          94.1          -0.21%

benchmark                                                                 old MB/s     new MB/s     speedup
BenchmarkNidOptNativeProtoMarshal-8                                       976.65       955.07       0.98x
BenchmarkNinOptNativeProtoMarshal-8                                       788.37       752.54       0.95x
BenchmarkNidRepNativeProtoMarshal-8                                       810.06       762.27       0.94x
BenchmarkNinRepNativeProtoMarshal-8                                       815.63       768.51       0.94x
BenchmarkNidRepPackedNativeProtoMarshal-8                                 389.24       361.05       0.93x
BenchmarkNinRepPackedNativeProtoMarshal-8                                 385.16       366.08       0.95x
BenchmarkNidOptStructProtoMarshal-8                                       863.95       825.83       0.96x
BenchmarkNinOptStructProtoMarshal-8                                       808.91       785.66       0.97x
BenchmarkNidRepStructProtoMarshal-8                                       710.38       683.64       0.96x
BenchmarkNinRepStructProtoMarshal-8                                       782.62       725.73       0.93x
BenchmarkNidEmbeddedStructProtoMarshal-8                                  860.52       829.86       0.96x
BenchmarkNinEmbeddedStructProtoMarshal-8                                  849.81       821.40       0.97x
BenchmarkNidNestedStructProtoMarshal-8                                    565.10       525.28       0.93x
BenchmarkNinNestedStructProtoMarshal-8                                    646.61       624.58       0.97x
BenchmarkNidOptCustomProtoMarshal-8                                       729.87       746.84       1.02x
BenchmarkCustomDashProtoMarshal-8                                         886.05       886.08       1.00x
BenchmarkNinOptCustomProtoMarshal-8                                       687.82       696.51       1.01x
BenchmarkNidRepCustomProtoMarshal-8                                       705.25       703.59       1.00x
BenchmarkNinRepCustomProtoMarshal-8                                       704.21       679.91       0.97x
BenchmarkNinOptNativeUnionProtoMarshal-8                                  231.80       232.44       1.00x
BenchmarkNinOptStructUnionProtoMarshal-8                                  453.62       457.92       1.01x
BenchmarkNinEmbeddedStructUnionProtoMarshal-8                             591.44       573.18       0.97x
BenchmarkNinNestedStructUnionProtoMarshal-8                               373.73       366.72       0.98x
BenchmarkTreeProtoMarshal-8                                               664.72       666.39       1.00x
BenchmarkOrBranchProtoMarshal-8                                           712.72       692.18       0.97x
BenchmarkAndBranchProtoMarshal-8                                          710.24       703.45       0.99x
BenchmarkLeafProtoMarshal-8                                               824.42       820.16       0.99x
BenchmarkDeepTreeProtoMarshal-8                                           585.23       576.84       0.99x
BenchmarkADeepBranchProtoMarshal-8                                        606.06       594.07       0.98x
BenchmarkAndDeepBranchProtoMarshal-8                                      557.97       549.21       0.98x
BenchmarkDeepLeafProtoMarshal-8                                           676.59       654.76       0.97x
BenchmarkNilProtoMarshal-8                                                682.93       698.93       1.02x
BenchmarkNidOptEnumProtoMarshal-8                                         596.44       599.27       1.00x
BenchmarkNinOptEnumProtoMarshal-8                                         521.93       527.05       1.01x
BenchmarkNidRepEnumProtoMarshal-8                                         320.25       316.64       0.99x
BenchmarkNinRepEnumProtoMarshal-8                                         319.78       321.59       1.01x
BenchmarkNinOptEnumDefaultProtoMarshal-8                                  525.05       526.44       1.00x
BenchmarkAnotherNinOptEnumProtoMarshal-8                                  528.30       519.95       0.98x
BenchmarkAnotherNinOptEnumDefaultProtoMarshal-8                           518.59       521.58       1.01x
BenchmarkTimerProtoMarshal-8                                              1011.16      1011.39      1.00x
BenchmarkMyExtendableProtoMarshal-8                                       174.04       157.02       0.90x
BenchmarkOtherExtenableProtoMarshal-8                                     153.66       157.91       1.03x
BenchmarkNestedDefinitionProtoMarshal-8                                   818.76       811.76       0.99x
BenchmarkNestedDefinition_NestedMessageProtoMarshal-8                     838.57       837.36       1.00x
BenchmarkNestedDefinition_NestedMessage_NestedNestedMsgProtoMarshal-8     871.31       878.69       1.01x
BenchmarkNestedScopeProtoMarshal-8                                        857.99       854.95       1.00x
BenchmarkNinOptNativeDefaultProtoMarshal-8                                768.10       752.14       0.98x
BenchmarkCustomContainerProtoMarshal-8                                    769.72       772.49       1.00x
BenchmarkCustomNameNidOptNativeProtoMarshal-8                             968.65       947.27       0.98x
BenchmarkCustomNameNinOptNativeProtoMarshal-8                             719.58       754.67       1.05x
BenchmarkCustomNameNinRepNativeProtoMarshal-8                             813.87       785.18       0.96x
BenchmarkCustomNameNinStructProtoMarshal-8                                739.54       740.75       1.00x
BenchmarkCustomNameCustomTypeProtoMarshal-8                               712.96       715.82       1.00x
BenchmarkCustomNameNinEmbeddedStructUnionProtoMarshal-8                   601.55       583.23       0.97x
BenchmarkCustomNameEnumProtoMarshal-8                                     417.49       441.00       1.06x
BenchmarkNoExtensionsMapProtoMarshal-8                                    695.54       684.15       0.98x
BenchmarkUnrecognizedProtoMarshal-8                                       673.51       677.96       1.01x
BenchmarkUnrecognizedWithInnerProtoMarshal-8                              548.84       557.06       1.01x
BenchmarkUnrecognizedWithInner_InnerProtoMarshal-8                        107.10       115.08       1.07x
BenchmarkUnrecognizedWithEmbedProtoMarshal-8                              700.99       704.09       1.00x
BenchmarkUnrecognizedWithEmbed_EmbeddedProtoMarshal-8                     114.23       114.32       1.00x
BenchmarkNodeProtoMarshal-8                                               844.78       833.02       0.99x
BenchmarkNonByteCustomTypeProtoMarshal-8                                  639.73       641.79       1.00x
BenchmarkNidOptNonByteCustomTypeProtoMarshal-8                            657.86       633.95       0.96x
BenchmarkNinOptNonByteCustomTypeProtoMarshal-8                            641.02       636.74       0.99x
BenchmarkNidRepNonByteCustomTypeProtoMarshal-8                            595.49       592.85       1.00x
BenchmarkNinRepNonByteCustomTypeProtoMarshal-8                            601.83       589.05       0.98x
BenchmarkProtoTypeProtoMarshal-8                                          869.89       871.54       1.00x

@awalterschulze
Copy link
Member Author

Our benchmarks also show that there is no significant difference between safe and unsafe.
This allows to remove optimizations with unsafe and simply rely on plain code generation.

We have not removed unsafe_marshaler and unsafe_unmarshaler, which will from now on generate the same code as marshaler and unmarshaler, simply for backwards compatibility reasons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant