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

Several perf improvements around shape processing #15661

Merged
merged 10 commits into from
Apr 8, 2024
5 changes: 3 additions & 2 deletions src/OrchardCore/OrchardCore.DisplayManagement/IShape.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Nodes;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Rendering;
Expand Down Expand Up @@ -98,12 +99,12 @@ public static TagBuilder GetTagBuilder(this IShape shape, string defaultTagName

var tagBuilder = new TagBuilder(tagName);

if (shape.Attributes != null)
if (shape.Attributes != null && shape.Attributes.Any())
sebastienros marked this conversation as resolved.
Show resolved Hide resolved
{
tagBuilder.MergeAttributes(shape.Attributes, false);
}

if (shape.Classes != null)
if (shape.Classes != null && shape.Classes.Any())
{
// Faster than AddCssClass which will do twice as many concatenations as classes.
tagBuilder.Attributes["class"] = string.Join(' ', shape.Classes);
sebastienros marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Loading