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

tes #69

Open
EgorBo opened this issue Sep 4, 2024 · 3 comments
Open

tes #69

EgorBo opened this issue Sep 4, 2024 · 3 comments

Comments

@EgorBo
Copy link

EgorBo commented Sep 4, 2024

No description provided.

@EgorBo
Copy link
Author

EgorBo commented Sep 4, 2024

@EgorBot -alltargets

using System.Text.Json;
using BenchmarkDotNet.Attributes;

public class Perf_Basic
{
    [Benchmark]
    public Employee? JsonRoundtrip()
    {
        Employee manager = new Employee("John", "Manager", 30, 185.5, new DateTime(1990, 10, 10), null);
        Employee employee = new Employee("John", "Manager", 30, 185.5, new DateTime(1990, 10, 10), manager);
        var str = JsonSerializer.Serialize(employee);
        return JsonSerializer.Deserialize<Employee>(str);
    }
}

public record Employee(string name, string title, int age, double height, DateTime applyDate, Employee? manager);

@EgorBo
Copy link
Author

EgorBo commented Sep 4, 2024

@EgorBot -alltargets

using System.Text.Json;
using BenchmarkDotNet.Attributes;

public class Perf_Basic
{
    static readonly Employee[] Data = Enumerable.Range(1, 4096)
        .Select(i => new Employee("John", "Manager", 30, 185.5, new DateTime(1990, 10, 10),
            new Employee("Джон", "Разработчик", 30 + i, 185.5, new DateTime(1990, 10, 10), null))).ToArray();

    [Benchmark]
    public Employee[]? JsonRoundtrip()
    {
        var str = JsonSerializer.Serialize(Data);
        return JsonSerializer.Deserialize<Employee[]>(str);
    }
}

public record Employee(string name, string title, int age, double height, DateTime applyDate, Employee? manager);

@EgorBo
Copy link
Author

EgorBo commented Sep 4, 2024

@EgorBot -intel -amd

using System.Text.Json;
using BenchmarkDotNet.Attributes;

public class Perf_Basic
{
    static readonly Employee[] Data = Enumerable.Range(1, 4096)
        .Select(i => new Employee("John", "Manager", 30, 185.5, new DateTime(1990, 10, 10),
            new Employee("Джон", "Разработчик", 30 + i, 185.5, new DateTime(1990, 10, 10), null))).ToArray();

    [Benchmark]
    public Employee[]? JsonRoundtrip()
    {
        var str = JsonSerializer.Serialize(Data);
        return JsonSerializer.Deserialize<Employee[]>(str);
    }
}

public record Employee(string name, string title, int age, double height, DateTime applyDate, Employee? manager);

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

No branches or pull requests

1 participant