Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #39107

Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why?????

Path csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Arno Welzel <usenet@arnowelzel.de>
Newsgroups comp.lang.javascript
Subject Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why?????
Date Mon, 2 Nov 2020 11:37:05 +0100
Lines 31
Message-ID <i0a5qfF52nrU1@mid.individual.net> (permalink)
References <5189ddb2-f717-40ed-8ab7-d58f84427d8eo@googlegroups.com> <f09c806b-ceff-4acb-b7f2-9d88dc46a26ao@googlegroups.com> <fd195b38-1147-4381-aa9d-0e70b291228fo@googlegroups.com> <2ed575bd-296e-43df-92ab-09265c196d8bo@googlegroups.com> <i07p3eFk78kU1@mid.individual.net> <a91f9849-21a2-499e-abf5-15408b0d6dd2o@googlegroups.com> <i08j0eFpi7mU2@mid.individual.net> <2c544c3a-2dea-472e-87cb-9578fd09072bo@googlegroups.com> <i0914uFsckrU2@mid.individual.net> <ef2a736b-6fbf-4e97-b44e-c5c8ea86b7f4o@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Trace individual.net ALaXdbO6FrLhAM6OXJPIjAEGrjr4+QSwf1gNs4TK95BWokOHo6
Cancel-Lock sha1:H+r7o7GSbOQL9SIS6cE+fKrQ83w=
In-Reply-To <ef2a736b-6fbf-4e97-b44e-c5c8ea86b7f4o@googlegroups.com>
Xref csiph.com comp.lang.javascript:39107

Show key headers only | View raw


Jonas Thörnvall:

[...]
> Yeah... So how did you mean i should use setTimeout and setInterval.

You should not do anything just because someone tells you to do so.

First you should understand what an event driven UI is and that
JavaScript is not multithreaded.

If your application needs to do something periodically but also should
handle user input, you have only two choices in JavaScript:

Use setInterval() or setTimeout() to keep things going by calling some
function which keeps the background stuff running by executing only one
thing at a time for each timer trigger so the browser still can pass
events to the event handlers.

As in <https://arnowelzel.de/en/projects/example-for-webgl> there is an
animation running constantly but at the same time user input is possible
as well to enable full screen view or stop and reset the animation.

OR:

Use workers (see
<https://developer.mozilla.org/en-US/docs/Web/API/Worker>) to start a
script as background process.

-- 
Arno Welzel
https://arnowelzel.de

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-10-31 13:26 -0700
  Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-10-31 13:37 -0700
    Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-10-31 13:41 -0700
  Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-10-31 13:54 -0700
  Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-10-31 17:51 -0700
    Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? luserdroog <luser.droog@gmail.com> - 2020-10-31 23:43 -0700
      Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-11-01 00:18 -0700
        Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Arno Welzel <usenet@arnowelzel.de> - 2020-11-01 13:47 +0100
          Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-11-01 09:11 -0800
          Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-11-01 09:15 -0800
            Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-11-01 09:21 -0800
              Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-11-01 09:52 -0800
                Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-11-01 11:27 -0800
                Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-11-01 11:33 -0800
                Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-11-01 15:42 -0800
                Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2020-11-08 23:36 +0100
                Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Silvio <silvio@internet.com> - 2020-11-09 17:01 +0100
                Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-11-01 11:37 -0800
              Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Arno Welzel <usenet@arnowelzel.de> - 2020-11-01 21:17 +0100
                Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-11-01 14:08 -0800
                Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Arno Welzel <usenet@arnowelzel.de> - 2020-11-02 01:09 +0100
            Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Arno Welzel <usenet@arnowelzel.de> - 2020-11-01 21:09 +0100
              Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-11-01 14:07 -0800
                Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Arno Welzel <usenet@arnowelzel.de> - 2020-11-02 01:11 +0100
                Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-11-01 16:18 -0800
                Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Arno Welzel <usenet@arnowelzel.de> - 2020-11-02 11:37 +0100
          Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-11-01 09:28 -0800
            Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Arno Welzel <usenet@arnowelzel.de> - 2020-11-01 21:22 +0100
              Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-11-01 14:10 -0800
                Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Arno Welzel <usenet@arnowelzel.de> - 2020-11-02 01:04 +0100
                Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-11-01 16:16 -0800
                Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Arno Welzel <usenet@arnowelzel.de> - 2020-11-02 11:40 +0100
                Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-11-11 00:21 -0800
                Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-11-11 09:13 -0800
                Re: Doing what you suggest, the timing for function calls using setInterval is just awful slow why????? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-11-01 16:19 -0800

csiph-web