Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8088665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:09:28+00:00 2026-06-05T19:09:28+00:00

I am trying to figure out if creating elements to render to the DOM

  • 0

I am trying to figure out if creating elements to render to the DOM is slower than using simple HTML tags, such as <h2> for example.

I set out with this question and didn’t find an answer here that I felt satisfied my curiosity. As a result, I decided to just make a simple test to run. This is not much of a question I realize as I am going to provide my findings but perhaps there are edge cases or others have some good tips.

I used some help from the mvc3 razor engine to generate large amounts of classic HTML elements.

Javascript Method:

<div id="appendHere">
</div>
<script type="text/javascript">
    var appenders = [];
    for(var i = 0; i < 10000; i++){
     var appenderIzer = document.createElement("h2");
     appenderIzer.innerHTML = "TestJs";
     document.getElementById("appendHere").appendChild(appenderIzer);
     appenders.push(appenderIzer);
    }
</script>

So here I am just going to be creating the element with javascript and then appending it to div element. I chose to store the elements in an array to see if that may also affect the loading performance.

Classical HTML (note the help of razor…writing out that many h2’s could be tedious)

@for (int i = 0; i < 10000; i++)
{
 <h2>TestClassic</h2>
}

In the end there was really no difference, perhaps nanoseconds. There may be factors which would highlight this difference but in the other variations I could not find them.

Are these findings accurate? Is there a difference in the time it takes to render a page from pure HTML tags versus from javascript-created javascript-appended elements?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:09:29+00:00Added an answer on June 5, 2026 at 7:09 pm

    Inserting DOM elements into an already rendered page is much slower than rendering those same elements from a page refresh. How much slower depends on how you do the insertions. It’s also largely dependent on how much styling you have, and how many layers of nested DOM there are. Browser version is also critical.

    Here is some (out of date) information:

    As you can see, the performance in IE7 degrades dramatically as the
    complexity of the HTML increases. If you put a timer before the
    innerHTML setter, you will see that the time increase to that point is
    negligible. It’s actually not a javascript performance problem at all;
    it’s DOM insertion performance!

    Up to 70% of IE performance is spent in rendering and layout, according to Microsoft.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to figure out the logic for creating tasks that have dependencies. In
I'm trying to figure out a good design for a Spring/Hibernate app. When creating
I am having issues trying to figure out how, to create an html input
I am creating a user interface and I am trying to figure out the
I'm new in creating database in Microsoft Access, I'm trying to figure out how
I'm trying to figure out the basic pattern for creating a JavaScript library (class).
when creating a Makefile, im trying to figure out how(if) i can change a
I am trying to figure out the way of creating table without a foreign
I'm creating a small game for a programming assignment. I'm trying to figure out
I have been trying to figure out how to write a simple program to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.