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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:07:22+00:00 2026-06-05T07:07:22+00:00

I am writing a CPU intensive javascript application. I am running into a problem

  • 0

I am writing a CPU intensive javascript application. I am running into a problem where sometimes the UI is locked while CPU-intensive calculation occurs. I know that the standard approach to solving this is to call setTimeout and let the event loop respond to UI events. However, that doesn’t work for me and here’s why.

When the page loads, the javascript vm needs to do a bunch of parsing and analyzing of chunks of data. This is truly background stuff, and I am calling setTimeout to run each chunk. However, this means that the user gets a very choppy UI experience until all chunks have been completed (can be up to 10 seconds for large files) and on every save. This is not acceptable.

I can think of 2 solutions, neither of which I really like:

  1. be more granular about the chunks, thus providing more opportunities for the event loop to run. But, I don’t like this because the cpu code is already quite complex, but it typically runs well. Calling setTimeout throughout the cpu bound code would make it far more complicated
  2. Do more work on the server. However, I am running a node server and this would simply push the problem from the client to the server, with the added problem of increased bandwidth.

Fixing this would be trivial on a traditional thread-based VM. What should I do for Javascript?


UPDATE:

Some points that I forgot to mention:

  • We are not concerned with legacy browsers and all users will be required to use a modern Firefox, Chrome, Opera, Safari, IE, etc.
  • Our initial prototype has the client and server co-located, but there should be nothing preventing us from moving to a remote server.
  • The data lives on the client (well…obviously, if the client and server are the same machine, but this will be the case even when we move to remote servers).

Webworkers might be the solution, but they do still seem flaky. Does anyone have experience with them? Are they stable? Which modern browsers do not support them well? Are there any general problems with them?

  • 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-05T07:07:23+00:00Added an answer on June 5, 2026 at 7:07 am

    Depending on whether this application will ever become public or not, you have to decide whether you can use Web Workers, split the data up more or do server-side processing. For real-world applications the real solution would be doing heavy computation on the server since you can’t expect the user to have the latest processor, it might be a mere netbook which will probably only cough a few times and then crash.

    Web workers would be a solution when you can be sure that users have the latest browsers that support it, however if that’s not the case, there’s no way to shim it like most HTML5 stuff.

    Based on what I know about your application, I’d say that you should send precomputed data to the client. Furthermore, Node.js is bad at doing hardcore computations so you might want to look into different data processing options on the server. Also, I don’t think bandwidth will be a problem since you have to give the client the initial data anyway. How much bigger is the processed data?

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

Sidebar

Related Questions

I'm writing a ruby program that need raw cpu power (I know ruby is
I'm writing some pretty CPU-intensive, concurrent numerical code that will process large amounts of
I am writing an application for any CPU. When I am running the following
Writing a client application that sends images to a server via a webservice. As
I'm writing a java application that runs in Tomcat, on a multi-core hardware. The
I'm currently writing a Java application that needs to look at how heavily loaded
I'm working on a piece of scientific software that is very cpu-intensive (its proc
I'm writing a red5 application in Java. it just means that I have a
I am writing a simple application that uses Threads to increase the performance. The
I have mainly CPU intensive operation which is running on a thread pool. Operation

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.