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

Upgrade to Dotnet 9 + Benchmarks #85

Merged
merged 8 commits into from
Nov 26, 2024
Merged
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
1 change: 0 additions & 1 deletion .docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3'
services:

postgres:
Expand Down
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ csharp_style_prefer_utf8_string_literals = true:suggestion
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
csharp_prefer_system_threading_lock = true:suggestion

# .NET Naming conventions

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x
- name: Build Reason
run: echo ${{github.ref}} and ${{github.event_name}}
- name: Install dependencies
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<LangVersion>Latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Insight.Database" Version="6.3.11" />
<PackageReference Include="Insight.Database" Version="8.0.1" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<AssemblyName>Insight.Database.Benchmarks.MySql</AssemblyName>
<RootNamespace>Insight.Database.Benchmarks.MySql</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Insight.Database.Providers.MySql" Version="6.3.11" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Insight.Database.Providers.MySql" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
170 changes: 85 additions & 85 deletions benchmarks/Insight.Database.Benchmarks.MySql/README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Insight.Database.Providers.PostgreSQL" Version="6.3.11" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Insight.Database.Providers.PostgreSQL" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,22 +136,19 @@ public void DbSetup()
var cmd = connection.CreateCommand();

cmd.CommandText = $@"
DROP TABLE IF EXISTS Comment;
DROP TABLE IF EXISTS Post;

CREATE TABLE IF NOT EXISTS Post
(
Id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
""Text"" Text NOT NULL,
CreationDate DATE NOT NULL,
LastChangeDate DATE NOT NULL
CreationDate TIMESTAMP WITH TIME ZONE NOT NULL,
LastChangeDate TIMESTAMP WITH TIME ZONE NOT NULL
);
CREATE TABLE IF NOT EXISTS Comment
(
Id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
PostId INT NOT NULL,
CommentText Text NOT NULL,
CreationDate DATE NOT NULL
CreationDate TIMESTAMP WITH TIME ZONE NOT NULL
);

DO $$
Expand All @@ -161,11 +158,11 @@ CreationDate DATE NOT NULL
iter := 0;
WHILE iter< {iterations} LOOP
INSERT INTO Post(""Text"", CreationDate, LastChangeDate)
SELECT REPEAT('x', 2000), NOW(), NOW();
SELECT REPEAT('x', 2000), timezone('UTC', now()), timezone('UTC', now());

INSERT INTO Comment(CommentText, CreationDate, PostId)
SELECT REPEAT('x', 2000), NOW(), currval(pg_get_serial_sequence('post', 'id')) UNION ALL
SELECT REPEAT('x', 2000), NOW(), currval(pg_get_serial_sequence('post', 'id'));
SELECT REPEAT('x', 2000), timezone('UTC', now()), currval(pg_get_serial_sequence('post', 'id')) UNION ALL
SELECT REPEAT('x', 2000), timezone('UTC', now()), currval(pg_get_serial_sequence('post', 'id'));

iter:= iter + 1;
END LOOP;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class InsightBenchmarkJson : BaseBenchmark

public static IEnumerable<Post> PostsJson()
{
yield return new Post() { Text = Text, CreationDate = DateTime.Now, LastChangeDate = DateTime.Now };
yield return new Post() { Text = Text, CreationDate = DateTime.UtcNow, LastChangeDate = DateTime.UtcNow };
}

[Benchmark(Description = "Insert<T> json")]
Expand Down Expand Up @@ -71,8 +71,8 @@ CREATE TABLE IF NOT EXISTS PostJson
(
Id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
Child JSON NOT NULL,
CreationDate DATE NOT NULL,
LastChangeDate DATE NOT NULL
CreationDate TIMESTAMP WITH TIME ZONE NOT NULL,
LastChangeDate TIMESTAMP WITH TIME ZONE NOT NULL
);

DO $$
Expand All @@ -86,7 +86,7 @@ WHILE iter< {iterations}
LOOP

INSERT INTO PostJson(Child, CreationDate, LastChangeDate)
SELECT ChildField, NOW(), NOW();
SELECT ChildField, timezone('UTC', now()), timezone('UTC', now());

iter:= iter + 1;
END LOOP;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class InsightBenchmarkWrite : InsightBenchmark
{
public static IEnumerable<Post> Posts()
{
yield return new Post() { Text = new string('x', 2000), CreationDate = DateTime.Now, LastChangeDate = DateTime.Now };
yield return new Post() { Text = new string('x', 2000), CreationDate = DateTime.UtcNow, LastChangeDate = DateTime.UtcNow };
}

[Benchmark(Description = "Insert<T>")]
Expand Down
Loading