Forums > Javascript

How slow is javascript, really?

October 26, 2006 | 3:20 pm

After Javascript and I fell in love everything felt just right. But now, things are starting to nag, as they always do eventually…

I’m now using javascript for almost anything that requires loops, dynamic variables and so on, but it seems that it works much much slower than regular max-language which becomes a big problem with intensive use.

I’ve got an example here:

Copy-paste the text in the comment-box next to the js-object into the js-object.

Then turn on the metro, you’ll see how the max-subpatch starts counting. Also watch your cpu.

Then click on the switch so the bangs will go to your javascript-code. This code does exactly the same thing. But watch your cpu and you’ll see that it makes a BIG difference.

My heart is broken… can anybody fix it?

————————————————————-

#P button 60 59 15 0;
#P user gswitch2 60 137 39 32 0 0;
#P window setfont "Sans Serif" 9.;
#P number 60 211 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 146 212 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 89 60 15 0;
#P window linecount 1;
#P newex 89 87 45 9109513 metro 40;
#P newex 89 113 42 9109513 uzi 2000;
#P newex 146 175 74 9109513 js javascript2.js;
#N vpatcher 15 55 615 455;
#P outlet 190 136 15 0;
#P window setfont "Sans Serif" 9.;
#N counter;
#X flags 0 0;
#P newobj 190 99 66 9109513 counter;
#P inlet 190 63 15 0;
#P connect 0 0 1 0;
#P connect 1 0 2 0;
#P pop;
#P newobj 60 175 71 9109513 p maxlanguage;
#P window linecount 3;
#P comment 222 176 163 9109513 count=0 ; function bang() {outlet(0 , (count++)) ; };
#P window linecount 2;
#P comment 222 140 100 9109513 put the following text into this js-object:;
#P connect 10 0 9 0;
#P connect 9 0 2 0;
#P connect 2 0 8 0;
#P connect 6 0 5 0;
#P connect 5 0 4 0;
#P connect 4 0 9 1;
#P connect 9 1 3 0;
#P connect 3 0 7 0;
#P window clipboard copycount 11;


October 27, 2006 | 8:25 am

thats a good eample, i also gave up on js for immediate things

On 10/26/06, Tarik wrote:
>
>
> After Javascript and I fell in love everything felt just right. But now,
> things are starting to nag, as they always do eventually…
>
> I’m now using javascript for almost anything that requires loops, dynamic
> variables and so on, but it seems that it works much much slower than
> regular max-language which becomes a big problem with intensive use.
>
> I’ve got an example here:
>
> Copy-paste the text in the comment-box next to the js-object into the
> js-object.
>
> Then turn on the metro, you’ll see how the max-subpatch starts counting.
> Also watch your cpu.
>
> Then click on the switch so the bangs will go to your javascript-code.
> This code does exactly the same thing. But watch your cpu and you’ll see
> that it makes a BIG difference.
>
> My heart is broken… can anybody fix it?
>
> ————————————————————-
>
>
> #P button 60 59 15 0;
> #P user gswitch2 60 137 39 32 0 0;
> #P window setfont "Sans Serif" 9.;
> #P number 60 211 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 146 212 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P toggle 89 60 15 0;
> #P window linecount 1;
> #P newex 89 87 45 9109513 metro 40;
> #P newex 89 113 42 9109513 uzi 2000;
> #P newex 146 175 74 9109513 js javascript2.js;
> #N vpatcher 15 55 615 455;
> #P outlet 190 136 15 0;
> #P window setfont "Sans Serif" 9.;
> #N counter;
> #X flags 0 0;
> #P newobj 190 99 66 9109513 counter;
> #P inlet 190 63 15 0;
> #P connect 0 0 1 0;
> #P connect 1 0 2 0;
> #P pop;
> #P newobj 60 175 71 9109513 p maxlanguage;
> #P window linecount 3;
> #P comment 222 176 163 9109513 count=0 ; function bang() {outlet(0 ,
> (count++)) ; };
> #P window linecount 2;
> #P comment 222 140 100 9109513 put the following text into this
> js-object:;
> #P connect 10 0 9 0;
> #P connect 9 0 2 0;
> #P connect 2 0 8 0;
> #P connect 6 0 5 0;
> #P connect 5 0 4 0;
> #P connect 4 0 9 1;
> #P connect 9 1 3 0;
> #P connect 3 0 7 0;
> #P window clipboard copycount 11;
>
>


Viewing 2 posts - 1 through 2 (of 2 total)