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

  • Home
  • SEARCH
  • 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 259589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:16:36+00:00 2026-05-11T22:16:36+00:00

I was testing something I read earlier about how random Math.random() really is, and

  • 0

I was testing something I read earlier about how random Math.random() really is, and wanted to display 10000 numbers that was supposed to be a random number between 0 and 10000000.

To see the test, I chose to just join the array of random numbers to a string with <br> between each integer. And then I just did $("#"+elm).html(randomNumberString); which was really slow. I just figured it was the generation and sorting of random numbers into an array. But as I started placing timers in my code, it got appearant that it was the output that was slowing everything down.

Just as a test I did document.getElementById(elm).innerHTML = randomNumberString;

jQuery.html(): 2500ms
getElementById.innerHTML: 170ms

I tried this across all 5 browsers, and the numbers were very close in all browsers… Am I using jQuery wrong in this instance? I also tried append and fetching the element before the timer started, so I could simply do $(elm).html(), but that didn’t help. It seems to be the actual html() function that’s slowing everything down..?

EDIT I ended up doing this:

randomStringNumber = "<div>" + randomStringNumber + "</div>";

and now the whole thing runs a lot faster:
jQuery.html(): 120ms
getElementById.innerHTML: 80ms

Still faster using oldschool html, though. And if anyone has an answer to why wrapping it in one element is faster, I’d appreciate that…

  • 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-05-11T22:16:36+00:00Added an answer on May 11, 2026 at 10:16 pm

    25 tip to improve your jquery use

    http://www.tvidesign.co.uk/blog/improve-your-jquery-25-excellent-tips.aspx

    http://acsenthil.wordpress.com/2011/07/04/improve-your-jquery-25-excellent-tips/

    1. Load the framework from Google Code
    2. Use a cheat sheet
    3. Combine all your scripts and minify them
    4. Use Firebug’s excellent console logging facilities
    5. Keep selection operations to a minimum by caching
    6. Keep DOM manipulation to a minimum
    7. Wrap everything in a single element when doing any kind of DOM insertion
    8. Use IDs instead of classes wherever possible
    9. Give your selectors a context
    10. Use chaining properly
    11. Learn to use animate properly
    12. Learn about event delegation
    13. Use classes to store state
    14. Even better, use jQuery’s internal data() method to store state
    15. Write your own selectors
    16. Streamline your HTML and modify it once the page has loaded
    17. Lazy load content for speed and SEO benefits
    18. Use jQuery’s utility functions
    19. Use noconflict to rename the jquery object when using other frameworks
    20. How to tell when images have loaded
    21. Always use the latest version
    22. How to check if an element exists
    23. Add a JS class to your HTML attribute
    24. Return ‘false’ to prevent default behaviour
    25. Shorthand for the ready event
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 231k
  • Answers 231k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Use the following function like this: Image('/path/to/original.image', '1/1', '150*', './thumb.jpg');… May 13, 2026 at 2:13 am
  • Editorial Team
    Editorial Team added an answer Check you database schema to see if the field (referenced… May 13, 2026 at 2:13 am
  • Editorial Team
    Editorial Team added an answer I figured out the problem - there was a session… May 13, 2026 at 2:13 am

Related Questions

I've read about 10 different questions on when and how to override GetHashCode but
I just read the Wikipedia article on mock objects , but I'm still not
I'm writing my first app with ASP.NET MVP (attempting Supervisory Controller) and Unit Testing
I know I'm just being OCD about a few milliseconds worth of performance time,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.