HTML unable to keep up with JS

No, I definitely mean append

His example shows a single box that displays the combination. Why would it be append?

Usually with a bruce force generator., it displays each attempt to a user. Not a list of combinations attempted.

Even so., he shouldnā€™t need multiple nodes, there could be a single node with values append to it.

Obviously multiplying the # nodes on page will break page.

Right, so put it in a separate thread, and update that way. I know why its not working, but writing a C++ service and a websocket server is nuts, (even just a websocket server) ā€” OP just wants an in-browser calculation to provide update feedback (which is fairly pointless, as can just show that the calculation is running and then that itā€™s finished), and is trying to render out nodes by appending at the same time as running a calculation on the same thread

Something else he could use is:

https://jsfiddle.net/oqy042fs/1/

Or use gif that shows fake attempts. Since thereā€™s no benefit of seeing the combinations except for seeing the effect.

Oh,. I missed that one.

Then perhaps requestAnimationFrame?

I thought device refresh rates are 60FPS , requestAnimationFrame matches that at best, 300FPS is nuts

I mean you can display what is being attempted, (which would be far behind) but then break loop once all attempts made or match found. And if match found,. display it.

requestAnimationFrame is 60 callbacks per second

right which means an update every ~16ms, take away a couple ms for computations and probably that is as best a browser could do. 300FPS would translate to the browser doing a transaction every ~3ms, thatā€™s nutso

Agreed. It also depends on the userā€™s monitor. I believe most are around 60Hz which have a max of 60FPS anyways.

@kerafyrm02 @Dereje1 @camperextraordinaire @DanCouper

Just logged on to find 20 reply notifications to my postā€¦

Thank you for the information. I have decided that I will add a ā€œCalculatingā€¦ā€ and then do all of the processing behind the scenes. This program is very hard on the HTML to handle and would not be feasible to update it even 60 times per second. Keep in mind, even without the HTML it takes upwards of 10 seconds for the page to catch up with the console.log()'s despite them only taking a matter of 100 - 200 millisecondsā€¦ Even if it is only every 1%.

Keep in mind it is not only creating a random string, but it is also doing if statements and checking multiple variables each loop. On top of this, it will sometimes run jQuery too.

Appending is easier to do than overwritting previous text, but even that is intensive.

I knew what FPS was, but did not think it would play a part in this issue. Thank you all for your help.

1 Like