File: Pages_Json_razor.g.cs
Project: src\src\Components\benchmarkapps\Wasm.Performance\TestApp\Wasm.Performance.TestApp.csproj (Wasm.Performance.TestApp)
#pragma checksum "D:\a\_work\1\s\src\Components\benchmarkapps\Wasm.Performance\TestApp\Pages\Json.razor" "{8829d00f-11b8-4213-878b-770e8597ac16}" "d6c71043bce0150a35ac478ed97ef89794015f9179e6d6c824b02a5a106fcacb"
// <auto-generated/>
#pragma warning disable 1591
namespace Wasm.Performance.TestApp.Pages
{
    #line default
    using global::System;
    using global::System.Collections.Generic;
    using global::System.Linq;
    using global::System.Threading.Tasks;
    using global::Microsoft.AspNetCore.Components;
#nullable restore
#line (1,2)-(1,23) "D:\a\_work\1\s\src\Components\benchmarkapps\Wasm.Performance\TestApp\_Imports.razor"
using System.Net.Http
 
#nullable disable
    ;
#nullable restore
#line (2,2)-(2,47) "D:\a\_work\1\s\src\Components\benchmarkapps\Wasm.Performance\TestApp\_Imports.razor"
using Microsoft.AspNetCore.Components.Routing
 
#nullable disable
    ;
#nullable restore
#line (3,2)-(3,45) "D:\a\_work\1\s\src\Components\benchmarkapps\Wasm.Performance\TestApp\_Imports.razor"
using Microsoft.AspNetCore.Components.Forms
 
#nullable disable
    ;
#nullable restore
#line (4,2)-(4,43) "D:\a\_work\1\s\src\Components\benchmarkapps\Wasm.Performance\TestApp\_Imports.razor"
using Microsoft.AspNetCore.Components.Web
 
#nullable disable
    ;
#nullable restore
#line (5,2)-(5,27) "D:\a\_work\1\s\src\Components\benchmarkapps\Wasm.Performance\TestApp\_Imports.razor"
using Microsoft.JSInterop
 
#nullable disable
    ;
#nullable restore
#line (6,2)-(6,32) "D:\a\_work\1\s\src\Components\benchmarkapps\Wasm.Performance\TestApp\_Imports.razor"
using Wasm.Performance.TestApp
 
#nullable disable
    ;
#nullable restore
#line (7,2)-(7,39) "D:\a\_work\1\s\src\Components\benchmarkapps\Wasm.Performance\TestApp\_Imports.razor"
using Wasm.Performance.TestApp.Shared
 
#nullable disable
    ;
#nullable restore
#line (2,2)-(2,24) "D:\a\_work\1\s\src\Components\benchmarkapps\Wasm.Performance\TestApp\Pages\Json.razor"
using System.Text.Json
 
#nullable disable
    ;
    #line default
    #line hidden
    [global::Microsoft.AspNetCore.Components.LayoutAttribute(typeof(
#nullable restore
#line (1,9)-(1,19) "D:\a\_work\1\s\src\Components\benchmarkapps\Wasm.Performance\TestApp\Pages\_Imports.razor"
MainLayout
 
#line default
#line hidden
#nullable disable
    ))]
    [global::Microsoft.AspNetCore.Components.RouteAttribute(
    // language=Route,Component
#nullable restore
#line (1,7)-(1,14) "D:\a\_work\1\s\src\Components\benchmarkapps\Wasm.Performance\TestApp\Pages\Json.razor"
"/json"
 
#line default
#line hidden
#nullable disable
    )]
    #nullable restore
    public partial class Json : global::Microsoft.AspNetCore.Components.ComponentBase
    #nullable disable
    {
        #pragma warning disable 1998
        protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
        {
            __builder.AddMarkupContent(0, "<h2>JSON performance</h2>\r\n\r\n");
            __builder.OpenElement(1, "p");
            __builder.OpenElement(2, "button");
            __builder.AddAttribute(3, "id", "reset-all");
            __builder.AddAttribute(4, "onclick", global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create<global::Microsoft.AspNetCore.Components.Web.MouseEventArgs>(this, 
#nullable restore
#line (7,36)-(7,41) "D:\a\_work\1\s\src\Components\benchmarkapps\Wasm.Performance\TestApp\Pages\Json.razor"
Reset
 
#line default
#line hidden
#nullable disable
            ));
            __builder.AddContent(5, "Reset");
            __builder.CloseElement();
            __builder.CloseElement();
            __builder.AddMarkupContent(6, "\r\n\r\n");
            __builder.OpenElement(7, "button");
            __builder.AddAttribute(8, "id", "serialize-small");
            __builder.AddAttribute(9, "onclick", global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create<global::Microsoft.AspNetCore.Components.Web.MouseEventArgs>(this, 
#nullable restore
#line (9,39)-(9,53) "D:\a\_work\1\s\src\Components\benchmarkapps\Wasm.Performance\TestApp\Pages\Json.razor"
SerializeSmall
 
#line default
#line hidden
#nullable disable
            ));
            __builder.AddContent(10, "Serialize (small)");
            __builder.CloseElement();
            __builder.AddMarkupContent(11, "\r\n");
            __builder.OpenElement(12, "button");
            __builder.AddAttribute(13, "id", "serialize-large");
            __builder.AddAttribute(14, "onclick", global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create<global::Microsoft.AspNetCore.Components.Web.MouseEventArgs>(this, 
#nullable restore
#line (10,39)-(10,53) "D:\a\_work\1\s\src\Components\benchmarkapps\Wasm.Performance\TestApp\Pages\Json.razor"
SerializeLarge
 
#line default
#line hidden
#nullable disable
            ));
            __builder.AddContent(15, "Serialize (large)");
            __builder.CloseElement();
            __builder.AddMarkupContent(16, "\r\n");
            __builder.OpenElement(17, "button");
            __builder.AddAttribute(18, "id", "serialize-large-sourcegen");
            __builder.AddAttribute(19, "onclick", global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create<global::Microsoft.AspNetCore.Components.Web.MouseEventArgs>(this, 
#nullable restore
#line (11,49)-(11,72) "D:\a\_work\1\s\src\Components\benchmarkapps\Wasm.Performance\TestApp\Pages\Json.razor"
SerializeLargeSourceGen
 
#line default
#line hidden
#nullable disable
            ));
            __builder.AddContent(20, "Serialize (large with sourcegen)");
            __builder.CloseElement();
            __builder.AddMarkupContent(21, "\r\n\r\n");
            __builder.OpenElement(22, "p");
            __builder.OpenElement(23, "pre");
            __builder.AddAttribute(24, "style", "border: 1px solid black; overflow: scroll;");
#nullable restore
#line (13,61)-(13,76) 25 "D:\a\_work\1\s\src\Components\benchmarkapps\Wasm.Performance\TestApp\Pages\Json.razor"
__builder.AddContent(25, serializedValue
 
#line default
#line hidden
#nullable disable
            );
            __builder.CloseElement();
            __builder.CloseElement();
#nullable restore
#line (14,2)-(16,1) "D:\a\_work\1\s\src\Components\benchmarkapps\Wasm.Performance\TestApp\Pages\Json.razor"
if (serializedValue != null)
{
 
#line default
#line hidden
#nullable disable
 
            __builder.OpenElement(26, "p");
            __builder.AddContent(27, "Serialized length: ");
            __builder.OpenElement(28, "strong");
            __builder.AddAttribute(29, "id", "serialized-length");
#nullable restore
#line (16,59)-(16,81) 25 "D:\a\_work\1\s\src\Components\benchmarkapps\Wasm.Performance\TestApp\Pages\Json.razor"
__builder.AddContent(30, serializedValue.Length
 
#line default
#line hidden
#nullable disable
            );
            __builder.CloseElement();
            __builder.AddContent(31, " chars");
            __builder.CloseElement();
#nullable restore
#line (17,1)-(18,1) "D:\a\_work\1\s\src\Components\benchmarkapps\Wasm.Performance\TestApp\Pages\Json.razor"
}
 
#line default
#line hidden
#nullable disable
 
            __builder.OpenElement(32, "button");
            __builder.AddAttribute(33, "id", "deserialize-small");
            __builder.AddAttribute(34, "onclick", global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create<global::Microsoft.AspNetCore.Components.Web.MouseEventArgs>(this, 
#nullable restore
#line (19,41)-(19,57) "D:\a\_work\1\s\src\Components\benchmarkapps\Wasm.Performance\TestApp\Pages\Json.razor"
DeserializeSmall
 
#line default
#line hidden
#nullable disable
            ));
            __builder.AddContent(35, "Deserialize (small)");
            __builder.CloseElement();
            __builder.AddMarkupContent(36, "\r\n");
            __builder.OpenElement(37, "button");
            __builder.AddAttribute(38, "id", "deserialize-large");
            __builder.AddAttribute(39, "onclick", global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create<global::Microsoft.AspNetCore.Components.Web.MouseEventArgs>(this, 
#nullable restore
#line (20,41)-(20,57) "D:\a\_work\1\s\src\Components\benchmarkapps\Wasm.Performance\TestApp\Pages\Json.razor"
DeserializeLarge
 
#line default
#line hidden
#nullable disable
            ));
            __builder.AddContent(40, "Deserialize (large)");
            __builder.CloseElement();
            __builder.AddMarkupContent(41, "\r\n");
            __builder.OpenElement(42, "button");
            __builder.AddAttribute(43, "id", "deserialize-large-sourcegen");
            __builder.AddAttribute(44, "onclick", global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create<global::Microsoft.AspNetCore.Components.Web.MouseEventArgs>(this, 
#nullable restore
#line (21,51)-(21,76) "D:\a\_work\1\s\src\Components\benchmarkapps\Wasm.Performance\TestApp\Pages\Json.razor"
DeserializeLargeSourceGen
 
#line default
#line hidden
#nullable disable
            ));
            __builder.AddContent(45, "Deserialize (large with sourcegen)");
            __builder.CloseElement();
#nullable restore
#line (23,2)-(25,1) "D:\a\_work\1\s\src\Components\benchmarkapps\Wasm.Performance\TestApp\Pages\Json.razor"
if (numPeopleDeserialized > 0)
{
 
#line default
#line hidden
#nullable disable
 
            __builder.OpenElement(46, "p");
            __builder.AddContent(47, "Deserialized ");
            __builder.OpenElement(48, "strong");
            __builder.AddAttribute(49, "id", "deserialized-count");
#nullable restore
#line (25,54)-(25,75) 25 "D:\a\_work\1\s\src\Components\benchmarkapps\Wasm.Performance\TestApp\Pages\Json.razor"
__builder.AddContent(50, numPeopleDeserialized
 
#line default
#line hidden
#nullable disable
            );
            __builder.CloseElement();
            __builder.AddContent(51, " people");
            __builder.CloseElement();
#nullable restore
#line (26,1)-(27,1) "D:\a\_work\1\s\src\Components\benchmarkapps\Wasm.Performance\TestApp\Pages\Json.razor"
}
 
#line default
#line hidden
#nullable disable
 
        }
        #pragma warning restore 1998
#nullable restore
#line (28,8)-(81,1) "D:\a\_work\1\s\src\Components\benchmarkapps\Wasm.Performance\TestApp\Pages\Json.razor"
 
    Person smallOrgChart = Person.GenerateOrgChart(1, 4);
    Person largeOrgChart = Person.GenerateOrgChart(5, 4);
    PersonJsonContext personJsonContext = new(new(JsonSerializerDefaults.Web));
    string smallOrgChartJson;
    string largeOrgChartJson;
    int numPeopleDeserialized;
 
    protected override void OnInitialized()
    {
        smallOrgChartJson = JsonSerializer.Serialize(smallOrgChart);
        largeOrgChartJson = JsonSerializer.Serialize(largeOrgChart);
    }
 
    protected override void OnAfterRender(bool firstRender)
    {
        BenchmarkEvent.Send(JSRuntime, "Finished JSON processing");
    }
 
    string serializedValue;
 
    void Reset()
    {
        serializedValue = null;
        numPeopleDeserialized = 0;
    }
 
    void SerializeSmall()
        => serializedValue = JsonSerializer.Serialize(smallOrgChart);
 
    void SerializeLarge()
        => serializedValue = JsonSerializer.Serialize(largeOrgChart);
 
    void SerializeLargeSourceGen()
        => serializedValue = JsonSerializer.Serialize(largeOrgChart, personJsonContext.Person);
 
    void DeserializeSmall()
        => numPeopleDeserialized = Deserialize(smallOrgChartJson);
 
    void DeserializeLarge()
        => numPeopleDeserialized = Deserialize(largeOrgChartJson);
 
    void DeserializeLargeSourceGen()
        => numPeopleDeserialized = CountPeople(JsonSerializer.Deserialize<Person>(largeOrgChartJson, personJsonContext.Person));
 
    static int Deserialize(string json)
    {
        var ceo = JsonSerializer.Deserialize<Person>(json);
        return CountPeople(ceo);
    }
 
    static int CountPeople(Person root)
        => 1 + (root.Subordinates?.Sum(CountPeople) ?? 0);
 
#line default
#line hidden
#nullable disable
 
        [global::Microsoft.AspNetCore.Components.InjectAttribute] private 
#nullable restore
#line (3,9)-(3,19) "D:\a\_work\1\s\src\Components\benchmarkapps\Wasm.Performance\TestApp\Pages\Json.razor"
IJSRuntime
 
#line default
#line hidden
#nullable disable
         
#nullable restore
#line (3,20)-(3,29) "D:\a\_work\1\s\src\Components\benchmarkapps\Wasm.Performance\TestApp\Pages\Json.razor"
JSRuntime
 
#line default
#line hidden
#nullable disable
         { get; set; }
         = default!;
    }
}
#pragma warning restore 1591