Visitar URL original
Super slow performance when there are lots of "a" html tags · Issue #239 · ArthurHub/HTML-Renderer · GitHub
Skip to content

Super slow performance when there are lots of "a" html tags #239

Open

Description

@a-v-ebrahimi

I am displaying an HTML, having about 200 a tags, the initial load and display of html is super slow.

When I modify IsBlockAssignableToBox function, so it does not add a tags, the performance issue is resolved ( and offcourse a tags are not rendered as links)

modifed IsBlockAssignableToBox version :

private static bool IsBlockAssignableToBox(CssBox box, CssBlock block)
        {
            bool assignable = true;
            if (block.Selectors != null)
            {
                assignable = IsBlockAssignableToBoxWithSelector(box, block);
            }
            else if (box.HtmlTag.Name.Equals("a", StringComparison.OrdinalIgnoreCase) && block.Class.Equals("a", StringComparison.OrdinalIgnoreCase)
                     // && !box.HtmlTag.HasAttribute("href")
                     )
            {
                assignable = false;
            }

            if (assignable && block.Hover)
            {
                box.HtmlContainer.AddHoverBox(box, block);
                assignable = false;
            }

            return assignable;
        }

Activity

  1. changed the title [-]Sloe performance when there are lots of "a" html tags[/-] [+]Super slow performance when there are lots of "a" html tags[/+] on Feb 8, 2026
  2. a-v-ebrahimi commented on Feb 8, 2026

    @a-v-ebrahimi
    Author

    I found if just remark case "color", the issue resolve and performance will be good. and offcourse colors will be lost !

    Image
  3. a-v-ebrahimi commented on Feb 8, 2026

    @a-v-ebrahimi
    Author

    If I return random color in TryGetColor, this will also boost performance, a lot.

    Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions