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


Groups > comp.lang.javascript > #39887

Loop optimisation.

From The Natural Philosopher <tnp@invalid.invalid>
Newsgroups comp.lang.javascript
Subject Loop optimisation.
Date 2021-04-10 18:41 +0100
Organization A little, after lunch
Message-ID <s4snvd$cr0$1@dont-email.me> (permalink)

Show all headers | View raw


Does Js do it?

I have some close to real time audio processing code and I want it to 
run floating point on a raspberry Pi - no FP coprocessors so no wasted 
cycles required.

The question is - in C if you do something like

function (int x)
for(somecondition)
	if (x greater than whatever)
		extra blah;
         else completely different blah;
endfor

will one hopes result in two completely different loops being 
established so that conditionl is actually  evaluated outside the loop - 
i.e

function (int x)
if (x greater than whatever)
	for(somecondition)
		extra blah;
	endfor
else
	for(somecondition)
		completely different blah;
	endfor
endif

is what a decent compiler optimised for speed might well do.

Does javascript though?

And of course Javascript makes all numbers floating point...so the 
comparison will be cycle hungry comparing  two floats


-- 
Of what good are dead warriors? … Warriors are those who desire battle 
more than peace. Those who seek battle despite peace. Those who thump 
their spears on the ground and talk of honor. Those who leap high the 
battle dance and dream of glory … The good of dead warriors, Mother, is 
that they are dead.
Sheri S Tepper: The Awakeners.

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


Thread

Loop optimisation. The Natural Philosopher <tnp@invalid.invalid> - 2021-04-10 18:41 +0100
  Re: Loop optimisation. John G Harris <niam@jghnorth.org.uk.invalid> - 2021-04-10 19:14 +0100
    Re: Loop optimisation. The Natural Philosopher <tnp@invalid.invalid> - 2021-04-11 11:33 +0100
      Re: Loop optimisation. John G Harris <niam@jghnorth.org.uk.invalid> - 2021-04-11 15:03 +0100
        Re: Loop optimisation. "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-04-11 07:38 -0700
          Re: Loop optimisation. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-11 13:36 -0700
          Re: Loop optimisation. John G Harris <niam@jghnorth.org.uk.invalid> - 2021-04-12 18:05 +0100
            Re: Loop optimisation. The Natural Philosopher <tnp@invalid.invalid> - 2021-04-12 23:16 +0100
              Re: Loop optimisation. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-13 05:19 -0700
                Re: Loop optimisation. "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-04-13 06:21 -0700
        Re: Loop optimisation. The Natural Philosopher <tnp@invalid.invalid> - 2021-04-12 01:36 +0100
          Re: Loop optimisation. John G Harris <niam@jghnorth.org.uk.invalid> - 2021-04-12 18:04 +0100
            Re: Loop optimisation. The Natural Philosopher <tnp@invalid.invalid> - 2021-04-12 23:09 +0100
              Re: Loop optimisation. John G Harris <niam@jghnorth.org.uk.invalid> - 2021-04-13 20:08 +0100
                Re: Loop optimisation. The Natural Philosopher <tnp@invalid.invalid> - 2021-04-13 21:41 +0100
                Re: Loop optimisation. John G Harris <niam@jghnorth.org.uk.invalid> - 2021-04-14 18:24 +0100
  Re: Loop optimisation. Kristjan Robam <he12457@hotmail.com> - 2021-04-10 13:36 -0700
    Re: Loop optimisation. The Natural Philosopher <tnp@invalid.invalid> - 2021-04-11 11:34 +0100
  Re: Loop optimisation. "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-04-10 22:22 -0700
    Re: Loop optimisation. The Natural Philosopher <tnp@invalid.invalid> - 2021-04-11 11:36 +0100
    Re: Loop optimisation. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-04-14 02:20 +0200
      Re: Loop optimisation. "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-04-14 06:48 -0700
        Re: Loop optimisation. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-04-14 17:31 +0200
          Re: Loop optimisation. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-04-14 18:00 +0200
            Re: Loop optimisation. The Natural Philosopher <tnp@invalid.invalid> - 2021-04-14 19:25 +0100
            Re: Loop optimisation. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-04-14 23:10 +0200
              Re: Loop optimisation. "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-04-17 09:45 -0700
            Re: Loop optimisation. "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-04-17 09:43 -0700
              Re: Loop optimisation. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-04-17 21:45 +0200
                Re: Loop optimisation. Scott Sauyet <scott.sauyet@gmail.com> - 2021-04-18 19:06 -0700
          Re: Loop optimisation. "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-04-17 08:50 -0700

csiph-web