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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:43:38+00:00 2026-05-26T06:43:38+00:00

The most obvious difference in speed was recursive traversal of dom elements in Javascript,

  • 0

The most obvious difference in speed was recursive traversal of dom elements in Javascript, which is always a lot faster than the same method implemented in Java.

Why is this the case? Why am I able to traverse dom document much quicker than Java, especially when they share the identical method (recursion).

  • 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-26T06:43:38+00:00Added an answer on May 26, 2026 at 6:43 am

    It’s because browsers do not have interpreters for java. They interpret javascript. The DOM is a model that can be used anywhere, but it used mostly in the browser environment, and browsers have optimized DOM parsing over the years… for javascript.

    The reason browsers have optimized DOM parsing is due to the fact that DOM parsing is a cornerstone of dynamic web development. Consider the normal way to make a page more dynamic:

    1.) Listen for some events fired on the page.
    2.) When those events are fired, modify some number of DOM objects, 
        e.g., by changing their visibility, geometry, or actually moving
        them to other portions of the DOM.
    

    The reason the DOM is important here is because it provides a specification for storing a document in browser memory so that an entire page doesn’t have to be re-rendered by changes to small portions of the markup. And these DOM objects stored in browser memory are structured just like native javascript objects; therefore, it’s easier to optimize for javascript against them.

    And ever since dynamic web pages have become essential, browsers have been fighting each other tooth and nail to have the fastest custom javascript interpreter, and in a dynamic web environment, the main place where you’re going to be able to see the most rewards for optimizing is DOM parsing.

    I can’t see the pressing need in a java environment to use a DOM, but it’s absolutely essential in a browser environment. That is the most likely reason you have seen better optimizations in javascript for DOM parsing than java. More people have a vested interest in making it work in the browser. However, for clarification, I’m not sure of the exact technical reasons at the code level why it’s actually faster.

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

Sidebar

Related Questions

I really suck at Rails' finders besides the most obvious. I always resort to
Most of time we represent concepts which can never be less than 0. For
The most obvious way to right-align a Label in WinForms doesn't work: setting anchor
I find it curious that the most obvious way to create Date objects in
Sometimes I break long conditions in if s onto several lines. The most obvious
I need to download several files via http in Python. The most obvious way
I develop in a proprietary script language with very resumed code in which most
I have tried to do this in many different ways but the most obvious
Most of my C/C++ development involves monolithic module files and absolutely no classes whatsoever,
Most program languages have some kind of exception handling; some languages have return codes,

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.