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 8016717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:37:03+00:00 2026-06-04T20:37:03+00:00

I have some data in a sql table. I send it via JSON to

  • 0

I have some data in a sql table. I send it via JSON to my JavaScript.

From there I need to compose it into HTML for display to the user by 1 of 2 ways.

  • By composing the html string and inserting into .innerHTML property of the holding element
  • By using createElment() for each element I need and appending into the DOM directly

Neither of the questions below gives a quantifiable answer.

From first answer in first link, 3rd Reason ( first two reasons stated don’t apply to my environment )

Could be faster in some cases

Can someone establish a base case of when createElement() method is faster and why?

That way people could make an educated guess of which to use, given their environment.

In my case I don’t have concerns for preserving existing DOM structure or Event Listeners. Just efficiency ( speed ).

I am not using a library regarding the second link I provided. But it is there for those who may.


Research / Links

Advantages of createElement over innerHTML?

JavaScript: Is it better to use innerHTML or (lots of) createElement calls to add a complex div structure?

  • 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-04T20:37:04+00:00Added an answer on June 4, 2026 at 8:37 pm

    Adding to the DOM n times takes n times more time than adding to the DOM a single time. (:P)

    This is the logic I’m personally following.

    In consequence, when it is about to create, for instance, a SELECT element, and add to it several options, I prefer to add up all options at once using innerHTML than using a createElement call n times.

    This is a bit the same as to compare BATCH operation to “one to one”… whenever you can factorise, you should!

    EDIT: Reading the comments I understand that there’s a feature (DOM DocumentFragment) that allow us saving such overhead and at the same time taking advantage of the DOM encapsulation. In this case, if the performances are really comparable, I would definitely not doubt and chose the DOM option.

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

Sidebar

Related Questions

I have some data in an SQL table with an XML datatype column where
We have recently moved some data from an SQL Database instance to another one
If have a piece of code that gets some data from a sql database
I have a form that is trying to insert some data into an SQL
I need to send HTML emails directly from oracle PL/SQL package. This works almost
I have a repeater that displays some data from a SQL query: <asp:Repeater runat=server
I am trying to export some data from a SQL Express table to Access
I have some troubles trying to move data from SQL Server 2000 (SP4) to
I have some varbinary data stored in a table in MS Sql Server 2005.
I have an old program pushing some data from a Microsoft SQL server database

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.