Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Arno Welzel Newsgroups: comp.lang.javascript Subject: Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Date: Sun, 1 Nov 2020 13:47:43 +0100 Lines: 30 Message-ID: References: <5189ddb2-f717-40ed-8ab7-d58f84427d8eo@googlegroups.com> <2ed575bd-296e-43df-92ab-09265c196d8bo@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net s8s4OYHitt6wzhJChZPSkA/Fr7xQIUt0g+wrpEQkxkWLbf2os8 Cancel-Lock: sha1:51hYg3SByBkJ+JPAtZwA07VNK9Y= In-Reply-To: <2ed575bd-296e-43df-92ab-09265c196d8bo@googlegroups.com> Xref: csiph.com comp.lang.javascript:39077 Jonas Thörnvall: > Den söndag 1 november 2020 kl. 07:43:43 UTC+1 skrev luserdroog: >> On Saturday, October 31, 2020 at 7:51:30 PM UTC-5, Jonas Thörnvall wrote: >> >>> Well i am done. >>> https://jonasth.github.io/random.html >> >> Did you figure out what the problem was? > > Yeah Javascript is really not suited for handling UI updated in realtime. It simply not possible to run loops "stop them" and update the UI in realtime. No, it's just you who is not able to deal with it. Example: How do you think are all games done using JavaScript and HTML5? > At least not in an efficient manner that make sense. Probably it should be possible to do in much more efficient way, by some polling technc. I can't simply see how setInterval can cause so much lag as it does. Define "lag". Depending on the capabilities of the browser and the hardware used the example above renders an animation of a 3D model at the exact refresh rate of your display. And this is all done in JavaScript and as soon as one clicks and drags inside the animation it stops and follows the mouse. -- Arno Welzel https://arnowelzel.de