You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by mg...@apache.org on 2022/03/03 14:37:18 UTC

[avro] branch branch-1.11 updated: AVRO-3416: Benchmarking project for C# (#1566)

This is an automated email from the ASF dual-hosted git repository.

mgrigorov pushed a commit to branch branch-1.11
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/branch-1.11 by this push:
     new 3edb024  AVRO-3416: Benchmarking project for C# (#1566)
3edb024 is described below

commit 3edb024ac4f7d70ba2ac1969651fff3a83404e6e
Author: Zoltan Csizmadia <zc...@gmail.com>
AuthorDate: Thu Mar 3 08:36:51 2022 -0600

    AVRO-3416: Benchmarking project for C# (#1566)
    
    * Add benchmarking project
    
    * Add license
    
    * Change namesapce to org.apache.avro.benchmark
    
    * Add license
    
    * Add benchmark to README.MD
    
    Co-authored-by: Zoltan Csizmadia <Cs...@valassis.com>
    (cherry picked from commit 5c1f4405ab46c68413a63a2206b49585a1d14695)
---
 lang/csharp/Avro.sln                               |  15 +-
 lang/csharp/README.md                              |   1 +
 lang/csharp/src/apache/benchmark/.gitignore        |   1 +
 .../src/apache/benchmark/Avro.benchmark.csproj     |  46 ++++
 lang/csharp/src/apache/benchmark/Benchmarks.cs     | 254 +++++++++++++++++++++
 lang/csharp/src/apache/benchmark/Program.cs        |  31 +++
 .../apache/avro/benchmark/big/mailing_address.cs   | 128 +++++++++++
 .../org/apache/avro/benchmark/big/userInfo.cs      | 128 +++++++++++
 .../org/apache/avro/benchmark/small/test.cs        |  73 ++++++
 lang/csharp/src/apache/benchmark/schema/big.avsc   |  62 +++++
 lang/csharp/src/apache/benchmark/schema/small.avsc |  13 ++
 lang/csharp/versions.props                         |   3 +-
 12 files changed, 753 insertions(+), 2 deletions(-)

diff --git a/lang/csharp/Avro.sln b/lang/csharp/Avro.sln
index b945f4e..7292351 100644
--- a/lang/csharp/Avro.sln
+++ b/lang/csharp/Avro.sln
@@ -36,7 +36,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
 		..\..\.editorconfig = ..\..\.editorconfig
 		.gitignore = .gitignore
 		Avro.ruleset = Avro.ruleset
-		build.ps1 = build.ps1
 		build.sh = build.sh
 		common.props = common.props
 		versions.props = versions.props
@@ -45,6 +44,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
 		README.md = README.md
 	EndProjectSection
 EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avro.benchmark", "src\apache\benchmark\Avro.benchmark.csproj", "{29271A29-9E89-47B1-A0CA-DD6704C89570}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -107,6 +108,18 @@ Global
 		{AC4E1909-2594-4D01-9B2B-B832C07BAFE5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
 		{AC4E1909-2594-4D01-9B2B-B832C07BAFE5}.Release|Mixed Platforms.Build.0 = Release|Any CPU
 		{AC4E1909-2594-4D01-9B2B-B832C07BAFE5}.Release|x86.ActiveCfg = Release|Any CPU
+		{29271A29-9E89-47B1-A0CA-DD6704C89570}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{29271A29-9E89-47B1-A0CA-DD6704C89570}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{29271A29-9E89-47B1-A0CA-DD6704C89570}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+		{29271A29-9E89-47B1-A0CA-DD6704C89570}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+		{29271A29-9E89-47B1-A0CA-DD6704C89570}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{29271A29-9E89-47B1-A0CA-DD6704C89570}.Debug|x86.Build.0 = Debug|Any CPU
+		{29271A29-9E89-47B1-A0CA-DD6704C89570}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{29271A29-9E89-47B1-A0CA-DD6704C89570}.Release|Any CPU.Build.0 = Release|Any CPU
+		{29271A29-9E89-47B1-A0CA-DD6704C89570}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+		{29271A29-9E89-47B1-A0CA-DD6704C89570}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+		{29271A29-9E89-47B1-A0CA-DD6704C89570}.Release|x86.ActiveCfg = Release|Any CPU
+		{29271A29-9E89-47B1-A0CA-DD6704C89570}.Release|x86.Build.0 = Release|Any CPU
 		{FFA119B2-0D60-4090-B5A6-ECA718138812}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{FFA119B2-0D60-4090-B5A6-ECA718138812}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{FFA119B2-0D60-4090-B5A6-ECA718138812}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
diff --git a/lang/csharp/README.md b/lang/csharp/README.md
index 8d829c0..b035f3c 100644
--- a/lang/csharp/README.md
+++ b/lang/csharp/README.md
@@ -30,6 +30,7 @@ Install-Package Apache.Avro
 | Avro.msbuild        |                            | Library    | ✔️                 | ✔️               |               |           |           |
 | Avro.perf           |                            | Exe        |                    |                   | ✔️            |✔️        |✔️        |
 | Avro.test           |                            | Unit Tests |                    |                   | ✔️            |✔️        |✔️        |
+| Avro.benchmark      |                            | Exe        |                    |                   | ✔️            |✔️        |✔️        |
 
 ## Dependency package version strategy
 
diff --git a/lang/csharp/src/apache/benchmark/.gitignore b/lang/csharp/src/apache/benchmark/.gitignore
new file mode 100644
index 0000000..43e0577
--- /dev/null
+++ b/lang/csharp/src/apache/benchmark/.gitignore
@@ -0,0 +1 @@
+BenchmarkDotNet.Artifacts/
\ No newline at end of file
diff --git a/lang/csharp/src/apache/benchmark/Avro.benchmark.csproj b/lang/csharp/src/apache/benchmark/Avro.benchmark.csproj
new file mode 100644
index 0000000..5b38895
--- /dev/null
+++ b/lang/csharp/src/apache/benchmark/Avro.benchmark.csproj
@@ -0,0 +1,46 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       https://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<Project Sdk="Microsoft.NET.Sdk">
+  <Import Project="../../../common.props" />
+
+  <PropertyGroup>
+    <TargetFrameworks>$(DefaultExeTargetFrameworks)</TargetFrameworks>
+	<OutputType>Exe</OutputType>
+  </PropertyGroup>
+  <PropertyGroup>
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <DebugSymbols>true</DebugSymbols>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+    <Optimize>true</Optimize>
+    <Configuration>Release</Configuration>
+    <IsPackable>false</IsPackable>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="BenchmarkDotNet" Version="$(BenchmarkDotNetVersion)" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\main\Avro.main.csproj" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <None Include="schema\**" CopyToOutputDirectory="PreserveNewest"/>
+  </ItemGroup>
+
+</Project>
\ No newline at end of file
diff --git a/lang/csharp/src/apache/benchmark/Benchmarks.cs b/lang/csharp/src/apache/benchmark/Benchmarks.cs
new file mode 100644
index 0000000..4c7ec73
--- /dev/null
+++ b/lang/csharp/src/apache/benchmark/Benchmarks.cs
@@ -0,0 +1,254 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System.Collections.Generic;
+using System.IO;
+using BenchmarkDotNet.Attributes;
+using Avro.Generic;
+using Avro.IO;
+using Avro.Specific;
+
+namespace Avro.Benchmark
+{
+    public class Benchmarks
+    {
+        private const int _numberOfRecordsInAvro = 100;
+
+        private readonly string _schemaStrSmall;
+        private readonly string _schemaStrBig;
+
+        private readonly RecordSchema _schemaSmall;
+        private readonly RecordSchema _schemaBig;
+        private readonly RecordSchema _schemaAddress;
+
+        private readonly byte[] _avroGenericSmall;
+        private readonly byte[] _avroGenericBig;
+        private readonly byte[] _avroSpecificSmall;
+        private readonly byte[] _avroSpecificBig;
+
+        public Benchmarks()
+        {
+            _schemaStrSmall = System.IO.File.ReadAllText("schema/small.avsc");
+            _schemaStrBig = System.IO.File.ReadAllText("schema/big.avsc");
+
+            _schemaSmall = (RecordSchema)Schema.Parse(_schemaStrSmall);
+            _schemaBig = (RecordSchema)Schema.Parse(_schemaStrBig);
+            _schemaAddress = (RecordSchema)_schemaBig["address"].Schema;
+
+            // Create avro for reading benchmarking
+            _avroGenericSmall = GenericRecordsToAvro(CreateGenericRecordSmall());
+            _avroGenericBig = GenericRecordsToAvro(CreateGenericRecordBig());
+
+            _avroSpecificSmall = SpecificRecordsToAvro(CreateSpecificRecordSmall());
+            _avroSpecificBig = SpecificRecordsToAvro(CreateSpecificRecordBig());
+        }
+
+        private byte[] GenericRecordsToAvro(GenericRecord record)
+        {
+            using (MemoryStream outputStream = new MemoryStream())
+            {
+                GenericDatumWriter<GenericRecord> writer = new GenericDatumWriter<GenericRecord>(record.Schema);
+                BinaryEncoder encoder = new BinaryEncoder(outputStream);
+
+                for (int i = 0; i < _numberOfRecordsInAvro; i++)
+                {
+                    writer.Write(record, encoder);
+                }
+
+                encoder.Flush();
+
+                return outputStream.ToArray();
+            }
+        }
+
+        private IList<GenericRecord> AvroToGenericRecordsToAvro(byte[] avro, RecordSchema schema)
+        {
+            using (MemoryStream inputStream = new MemoryStream(avro))
+            {
+                GenericDatumReader<GenericRecord> reader = new GenericDatumReader<GenericRecord>(schema, schema);
+                BinaryDecoder decoder = new BinaryDecoder(inputStream);
+                List<GenericRecord> records = new List<GenericRecord>();
+
+                for (int i = 0; i < _numberOfRecordsInAvro; i++)
+                {
+                    GenericRecord record = reader.Read(null, decoder);
+                    if (record == null)
+                        break;
+                    records.Add(record);
+                }
+
+                return records;
+            }
+        }
+
+        private byte[] SpecificRecordsToAvro<T>(T record) where T : ISpecificRecord
+        {
+            using (MemoryStream outputStream = new MemoryStream())
+            {
+                SpecificDatumWriter<T> writer = new SpecificDatumWriter<T>(record.Schema);
+                BinaryEncoder encoder = new BinaryEncoder(outputStream);
+
+                for (int i = 0; i < _numberOfRecordsInAvro; i++)
+                {
+                    writer.Write(record, encoder);
+                }
+
+                encoder.Flush();
+
+                return outputStream.ToArray();
+            }
+        }
+
+        private IList<T> AvroToSpecificRecords<T>(byte[] avro, RecordSchema schema) where T : ISpecificRecord
+        {
+            using (MemoryStream inputStream = new MemoryStream(avro))
+            {
+                SpecificDatumReader<T> reader = new SpecificDatumReader<T>(schema, schema);
+                BinaryDecoder decoder = new BinaryDecoder(inputStream);
+                List<T> records = new List<T>();
+
+                for (int i = 0; i < _numberOfRecordsInAvro; i++)
+                {
+                    T record = reader.Read(default, decoder); ;
+                    if (record == null)
+                        break;
+                    records.Add(record);
+                }
+
+                return records;
+            }
+        }
+
+        [Benchmark]
+        public void ParseSchemaSmall()
+        {
+            Schema.Parse(_schemaStrSmall);
+        }
+
+        [Benchmark]
+        public void ParseSchemaBig()
+        {
+            Schema.Parse(_schemaStrBig);
+        }
+
+        [Benchmark]
+        public GenericRecord CreateGenericRecordSmall()
+        {
+            GenericRecord record = new GenericRecord(_schemaSmall);
+            record.Add("field", "foo");
+
+            return record;
+        }
+
+        [Benchmark]
+        public GenericRecord CreateGenericRecordBig()
+        {
+            GenericRecord address = new GenericRecord(_schemaAddress);
+            address.Add("street", "street");
+            address.Add("city", "city");
+            address.Add("state_prov", "state_prov");
+            address.Add("country", "country");
+            address.Add("zip", "zip");
+
+            GenericRecord record = new GenericRecord(_schemaBig);
+            record.Add("username", "username");
+            record.Add("age", 10);
+            record.Add("phone", "000000000");
+            record.Add("housenum", "0000");
+            record.Add("address", address);
+
+            return record;
+        }
+
+        [Benchmark]
+        public ISpecificRecord CreateSpecificRecordSmall()
+        {
+            return new org.apache.avro.benchmark.small.test()
+            {
+                field = "foo"
+            };
+        }
+
+        [Benchmark]
+        public ISpecificRecord CreateSpecificRecordBig()
+        {
+            return new org.apache.avro.benchmark.big.userInfo()
+            {
+                username = "username",
+                age = 10,
+                phone = "000000000",
+                housenum = "0000",
+                address = new org.apache.avro.benchmark.big.mailing_address()
+                {
+                    street = "street",
+                    city = "city",
+                    state_prov = "state_prov",
+                    country = "country",
+                    zip = "zip"
+                }
+            };
+        }
+
+        [Benchmark]
+        public void GenericRecordsToAvroSmall()
+        {
+            GenericRecordsToAvro(CreateGenericRecordSmall());
+        }
+
+        [Benchmark]
+        public void GenericRecordsToAvroBig()
+        {
+            GenericRecordsToAvro(CreateGenericRecordBig());
+        }
+
+        [Benchmark]
+        public void AvroToGenericRecordsSmall()
+        {
+            AvroToGenericRecordsToAvro(_avroGenericSmall, _schemaSmall);
+        }
+
+        [Benchmark]
+        public void AvroToGenericRecordsBig()
+        {
+            AvroToGenericRecordsToAvro(_avroGenericBig, _schemaBig);
+        }
+
+        [Benchmark]
+        public void SpecificRecordsToAvroSmall()
+        {
+            SpecificRecordsToAvro(CreateSpecificRecordSmall());
+        }
+
+        [Benchmark]
+        public void SpecificRecordsToAvroBig()
+        {
+            SpecificRecordsToAvro(CreateSpecificRecordBig());
+        }
+
+        [Benchmark]
+        public void AvroToSpecificRecordsSmall()
+        {
+            AvroToSpecificRecords<org.apache.avro.benchmark.small.test>(_avroSpecificSmall, _schemaSmall);
+        }
+
+        [Benchmark]
+        public void AvroToSpecificRecordsBig()
+        {
+            AvroToSpecificRecords<org.apache.avro.benchmark.big.userInfo>(_avroSpecificBig, _schemaBig);
+        }
+    }
+}
diff --git a/lang/csharp/src/apache/benchmark/Program.cs b/lang/csharp/src/apache/benchmark/Program.cs
new file mode 100644
index 0000000..4381897
--- /dev/null
+++ b/lang/csharp/src/apache/benchmark/Program.cs
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using BenchmarkDotNet.Running;
+
+namespace Avro.Benchmark
+{
+    public class Program
+    {
+        // dotnet run -c Release -f net6.0
+        // dotnet run -c Release -f net6.0 --runtimes netcoreapp3.1 net5.0 net6.0
+        public static void Main(string[] args)
+        {
+            BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
+        }
+    }
+}
diff --git a/lang/csharp/src/apache/benchmark/org/apache/avro/benchmark/big/mailing_address.cs b/lang/csharp/src/apache/benchmark/org/apache/avro/benchmark/big/mailing_address.cs
new file mode 100644
index 0000000..10f003d
--- /dev/null
+++ b/lang/csharp/src/apache/benchmark/org/apache/avro/benchmark/big/mailing_address.cs
@@ -0,0 +1,128 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// ------------------------------------------------------------------------------
+// <auto-generated>
+//    Generated by avrogen, version 1.11.0.0
+//    Changes to this file may cause incorrect behavior and will be lost if code
+//    is regenerated
+// </auto-generated>
+// ------------------------------------------------------------------------------
+namespace org.apache.avro.benchmark.big
+{
+	using System;
+	using System.Collections.Generic;
+	using System.Text;
+	using Avro;
+	using Avro.Specific;
+	
+	public partial class mailing_address : ISpecificRecord
+	{
+		public static Schema _SCHEMA = Avro.Schema.Parse(@"{""type"":""record"",""name"":""mailing_address"",""namespace"":""org.apache.avro.benchmark.big"",""fields"":[{""name"":""street"",""default"":""NONE"",""type"":""string""},{""name"":""city"",""default"":""NONE"",""type"":""string""},{""name"":""state_prov"",""default"":""NONE"",""type"":""string""},{""name"":""country"",""default"":""NONE"",""type"":""string""},{""name"":""zip"",""default"":""NONE"",""type"":""string""}]}");
+		private string _street;
+		private string _city;
+		private string _state_prov;
+		private string _country;
+		private string _zip;
+		public virtual Schema Schema
+		{
+			get
+			{
+				return mailing_address._SCHEMA;
+			}
+		}
+		public string street
+		{
+			get
+			{
+				return this._street;
+			}
+			set
+			{
+				this._street = value;
+			}
+		}
+		public string city
+		{
+			get
+			{
+				return this._city;
+			}
+			set
+			{
+				this._city = value;
+			}
+		}
+		public string state_prov
+		{
+			get
+			{
+				return this._state_prov;
+			}
+			set
+			{
+				this._state_prov = value;
+			}
+		}
+		public string country
+		{
+			get
+			{
+				return this._country;
+			}
+			set
+			{
+				this._country = value;
+			}
+		}
+		public string zip
+		{
+			get
+			{
+				return this._zip;
+			}
+			set
+			{
+				this._zip = value;
+			}
+		}
+		public virtual object Get(int fieldPos)
+		{
+			switch (fieldPos)
+			{
+			case 0: return this.street;
+			case 1: return this.city;
+			case 2: return this.state_prov;
+			case 3: return this.country;
+			case 4: return this.zip;
+			default: throw new AvroRuntimeException("Bad index " + fieldPos + " in Get()");
+			};
+		}
+		public virtual void Put(int fieldPos, object fieldValue)
+		{
+			switch (fieldPos)
+			{
+			case 0: this.street = (System.String)fieldValue; break;
+			case 1: this.city = (System.String)fieldValue; break;
+			case 2: this.state_prov = (System.String)fieldValue; break;
+			case 3: this.country = (System.String)fieldValue; break;
+			case 4: this.zip = (System.String)fieldValue; break;
+			default: throw new AvroRuntimeException("Bad index " + fieldPos + " in Put()");
+			};
+		}
+	}
+}
diff --git a/lang/csharp/src/apache/benchmark/org/apache/avro/benchmark/big/userInfo.cs b/lang/csharp/src/apache/benchmark/org/apache/avro/benchmark/big/userInfo.cs
new file mode 100644
index 0000000..4ddbe0a
--- /dev/null
+++ b/lang/csharp/src/apache/benchmark/org/apache/avro/benchmark/big/userInfo.cs
@@ -0,0 +1,128 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// ------------------------------------------------------------------------------
+// <auto-generated>
+//    Generated by avrogen, version 1.11.0.0
+//    Changes to this file may cause incorrect behavior and will be lost if code
+//    is regenerated
+// </auto-generated>
+// ------------------------------------------------------------------------------
+namespace org.apache.avro.benchmark.big
+{
+	using System;
+	using System.Collections.Generic;
+	using System.Text;
+	using Avro;
+	using Avro.Specific;
+	
+	public partial class userInfo : ISpecificRecord
+	{
+		public static Schema _SCHEMA = Avro.Schema.Parse(@"{""type"":""record"",""name"":""userInfo"",""namespace"":""org.apache.avro.benchmark.big"",""fields"":[{""name"":""username"",""default"":""NONE"",""type"":""string""},{""name"":""age"",""default"":-1,""type"":""int""},{""name"":""phone"",""default"":""NONE"",""type"":""string""},{""name"":""housenum"",""default"":""NONE"",""type"":""string""},{""name"":""address"",""default"":{},""type"":{""type"":""record"",""name"":""mailing_address [...]
+		private string _username;
+		private int _age;
+		private string _phone;
+		private string _housenum;
+		private org.apache.avro.benchmark.big.mailing_address _address;
+		public virtual Schema Schema
+		{
+			get
+			{
+				return userInfo._SCHEMA;
+			}
+		}
+		public string username
+		{
+			get
+			{
+				return this._username;
+			}
+			set
+			{
+				this._username = value;
+			}
+		}
+		public int age
+		{
+			get
+			{
+				return this._age;
+			}
+			set
+			{
+				this._age = value;
+			}
+		}
+		public string phone
+		{
+			get
+			{
+				return this._phone;
+			}
+			set
+			{
+				this._phone = value;
+			}
+		}
+		public string housenum
+		{
+			get
+			{
+				return this._housenum;
+			}
+			set
+			{
+				this._housenum = value;
+			}
+		}
+		public org.apache.avro.benchmark.big.mailing_address address
+		{
+			get
+			{
+				return this._address;
+			}
+			set
+			{
+				this._address = value;
+			}
+		}
+		public virtual object Get(int fieldPos)
+		{
+			switch (fieldPos)
+			{
+			case 0: return this.username;
+			case 1: return this.age;
+			case 2: return this.phone;
+			case 3: return this.housenum;
+			case 4: return this.address;
+			default: throw new AvroRuntimeException("Bad index " + fieldPos + " in Get()");
+			};
+		}
+		public virtual void Put(int fieldPos, object fieldValue)
+		{
+			switch (fieldPos)
+			{
+			case 0: this.username = (System.String)fieldValue; break;
+			case 1: this.age = (System.Int32)fieldValue; break;
+			case 2: this.phone = (System.String)fieldValue; break;
+			case 3: this.housenum = (System.String)fieldValue; break;
+			case 4: this.address = (org.apache.avro.benchmark.big.mailing_address)fieldValue; break;
+			default: throw new AvroRuntimeException("Bad index " + fieldPos + " in Put()");
+			};
+		}
+	}
+}
diff --git a/lang/csharp/src/apache/benchmark/org/apache/avro/benchmark/small/test.cs b/lang/csharp/src/apache/benchmark/org/apache/avro/benchmark/small/test.cs
new file mode 100644
index 0000000..b0553d1
--- /dev/null
+++ b/lang/csharp/src/apache/benchmark/org/apache/avro/benchmark/small/test.cs
@@ -0,0 +1,73 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// ------------------------------------------------------------------------------
+// <auto-generated>
+//    Generated by avrogen, version 1.11.0.0
+//    Changes to this file may cause incorrect behavior and will be lost if code
+//    is regenerated
+// </auto-generated>
+// ------------------------------------------------------------------------------
+namespace org.apache.avro.benchmark.small
+{
+	using System;
+	using System.Collections.Generic;
+	using System.Text;
+	using Avro;
+	using Avro.Specific;
+	
+	public partial class test : ISpecificRecord
+	{
+		public static Schema _SCHEMA = Avro.Schema.Parse("{\"type\":\"record\",\"name\":\"test\",\"namespace\":\"org.apache.avro.benchmark.small\",\"fie" +
+				"lds\":[{\"name\":\"field\",\"type\":\"string\"}]}");
+		private string _field;
+		public virtual Schema Schema
+		{
+			get
+			{
+				return test._SCHEMA;
+			}
+		}
+		public string field
+		{
+			get
+			{
+				return this._field;
+			}
+			set
+			{
+				this._field = value;
+			}
+		}
+		public virtual object Get(int fieldPos)
+		{
+			switch (fieldPos)
+			{
+			case 0: return this.field;
+			default: throw new AvroRuntimeException("Bad index " + fieldPos + " in Get()");
+			};
+		}
+		public virtual void Put(int fieldPos, object fieldValue)
+		{
+			switch (fieldPos)
+			{
+			case 0: this.field = (System.String)fieldValue; break;
+			default: throw new AvroRuntimeException("Bad index " + fieldPos + " in Put()");
+			};
+		}
+	}
+}
diff --git a/lang/csharp/src/apache/benchmark/schema/big.avsc b/lang/csharp/src/apache/benchmark/schema/big.avsc
new file mode 100644
index 0000000..d907530
--- /dev/null
+++ b/lang/csharp/src/apache/benchmark/schema/big.avsc
@@ -0,0 +1,62 @@
+{
+  "namespace": "org.apache.avro.benchmark.big",
+  "type": "record",
+  "name": "userInfo",
+  "fields": [
+    {
+      "default": "NONE",
+      "type": "string",
+      "name": "username"
+    },
+    {
+      "default": -1,
+      "type": "int",
+      "name": "age"
+    },
+    {
+      "default": "NONE",
+      "type": "string",
+      "name": "phone"
+    },
+    {
+      "default": "NONE",
+      "type": "string",
+      "name": "housenum"
+    },
+    {
+      "default": {},
+      "type": {
+        "fields": [
+          {
+            "default": "NONE",
+            "type": "string",
+            "name": "street"
+          },
+          {
+            "default": "NONE",
+            "type": "string",
+            "name": "city"
+          },
+          {
+            "default": "NONE",
+            "type": "string",
+            "name": "state_prov"
+          },
+          {
+            "default": "NONE",
+            "type": "string",
+            "name": "country"
+          },
+          {
+            "default": "NONE",
+            "type": "string",
+            "name": "zip"
+          }
+        ],
+        "type": "record",
+        "name": "mailing_address"
+      },
+      "name": "address"
+    }
+  ]
+}
\ No newline at end of file
diff --git a/lang/csharp/src/apache/benchmark/schema/small.avsc b/lang/csharp/src/apache/benchmark/schema/small.avsc
new file mode 100644
index 0000000..ee32070
--- /dev/null
+++ b/lang/csharp/src/apache/benchmark/schema/small.avsc
@@ -0,0 +1,13 @@
+{
+  "namespace": "org.apache.avro.benchmark.small",
+  "type": "record",
+  "name": "test",
+  "fields": [
+    {
+      "type": {
+        "type": "string"
+      },
+      "name": "field"
+    }
+  ]
+}
\ No newline at end of file
diff --git a/lang/csharp/versions.props b/lang/csharp/versions.props
index 6b767c6..15cc410 100644
--- a/lang/csharp/versions.props
+++ b/lang/csharp/versions.props
@@ -53,7 +53,8 @@
   <!--
     These packages are used for building, testing and code analysis. Most likely they are safe to upgrade
   -->
-  <PropertyGroup Label="Build, Test, Code Analysis Package Versions">
+  <PropertyGroup Label="Build, Test, Code Analysis, Benchmark Package Versions">
+    <BenchmarkDotNetVersion>0.13.1</BenchmarkDotNetVersion>
     <MicrosoftBuildFrameworkVersion>17.0.0</MicrosoftBuildFrameworkVersion>
     <MicrosoftBuildUtilitiesCoreVersion>17.0.0</MicrosoftBuildUtilitiesCoreVersion>
     <MicrosoftCodeAnalysisCSharpCodeStyleVersion>4.0.1</MicrosoftCodeAnalysisCSharpCodeStyleVersion>