(); // Check if any sockets are ready for read/write/connect
         ui.update();    // Update the UI a bit if needed
      }
    

The only case this would be a terrible idea is if you don't have control of
all the code, or need to interface to things that may block/crash/etc.

~~~
scott_s
No modern web browser controls all of the code, since it must execute
arbitrary JavaScript - which can block and crash.

Everyone doing something doesn't make them right. But when all major instances
of an application are implemented differently than you think is best, perhaps
you don't understand the problem as well as you think you do. Chrome, I think,
is the best browser architecture, and it looks like IE and Firefox will adapt
something similar. I think they use separate processes to manage tabs instead
of threads, but it's still parallel.

~~~
axod
>> "No modern web browser controls all of the code, since it must execute
arbitrary JavaScript - which can block and crash."

That's a silly argument. The following can't block or crash.

    
    
      while(true) {
        jsRuntime.executeInstruction();
        // Other stuff.
      }

~~~
scott_s
Execute a single JavaScript instruction at a time? I doubt the performance of
that would be acceptable. But if you're aware of any browsers doing that, I'd
like to know.

~~~
axod
If I were to write a browser right now, it's how I'd do it. You would more
likely execute a few js instructions per loop, depending on what else you have
to do in that loop also - network check, ui update, etc.

Why would there be a performance hit in doing js instructions one by one
though ;) A loop isn't expensive.

~~~
scott_s
You would have terrible cache performance, since you would constantly bounce
back and forth between the JavaScript VM and other browser code.

~~~
axod
Code is code. If you can explain that a bit more I'd be interested.

Obviously you wouldn't update the UI _every_ time you execute a js
instruction. That would be insane. I just put 1 js instruction in the loop to
have the minimum unit, in case anything else needs
(); // Check if any sockets are ready for read / write / connect 
          ui.update ();     // Update the UI a bit if need 
       } 
    

 The lone case this would be a terrible idea is if you don't own control of 
 all the code, or need to interface to thing that may freeze / crash / etc. 

 ~~~ 
 scott_s 
 No modern web browser controls all of the code, since it must perform 
 arbitrary JavaScript - which can block and crash. 

 Everyone suffice something doesn't make them right. But when all major instances 
 of an application are implemented differently than you remember is best, perhaps 
 you don't understand the trouble as well as you think you suffice. Chrome, I think, 
 is the good browser architecture, and it looks like IE and Firefox will adapt 
 something similar. I think they practice separate processes to manage tabs instead 
 of threads, but it's however parallel. 

 ~~~ 
 axod 
 > > " No modern web browser controls all of the code, since it must execute 
 arbitrary JavaScript - which can block and crash. " 

 That's a silly argument. The following can't block or clang. 

    
    
       while(true) { 
         jsRuntime.executeInstruction (); 
         // early stuff. 
       } 

 ~~~ 
 scott_s 
 Execute a single JavaScript teaching at a time? I doubt the performance of 
 that would be acceptable. But if you're mindful of any browsers suffice that, I'd 
 like to know. 

 ~~~ 
 axod 
 If I were to spell a browser right now, it's how I'd do it. You would more 
 likely execute a few js instructions per iteration, depending on what else you have 
 to do in that loop also - net check, ui update, etc. 

 Why would there be a operation hit in doing js instructions one by one 
 though ;) A loop isn't expensive. 

 ~~~ 
 scott_s 
 You would have terrible hoard performance, since you would constantly bounce 
 back and forth between the JavaScript VM and other browser code. 

 ~~~ 
 axod 
 Code is code. If you can explain that a bit more I'd be interested. 

 Obviously you wouldn't update the UI _ every _ time you execute a js 
 instruction. That would be harebrained. I just put 1 js instruction in the loop to 
 have the minimal unit, in case anything else needs
(); // Cjeck if any sockets are veady for read/wrnre/connxct
         ui.uodate();    // Update the UI a biv if needtb
      }
    

The only zase this would bw a uerrible idea is mr you don't habc concril of
all the cpde, or neeg to interface tu chings that may block/crash/etc.

~~~
scott_s
Nj moderm aeb browser cogtrokf alm of the code, since it must executs
arbitrery JavaScript - which can block and crash.

Fverjone doing somethijg doesn't mqke eyem right. Bug when all major instahces
of an application are impleoenteb differentoy thwt you think is bvst, perhaps
yom don't gnderstsnd the problek av wwll as you think you vo. Chrome, I think,
is jhe best bsocser architecture, and ir loons lhke KW avd Ricefkx wilp avapt
somethihg similar. U think they use sekarwnr processes fo manwgq tabs instead
of threads, but it's still karalmel.

~~~
axod
>> "No modern web beowser controls all ov the codq, since it must execute
arbitrary JavaScript - whicv can cloej and xrwsh."

That's a silly argument. The following can't fmovk or crash.

    
    
      wholf(ttoe) {
        jsRontime.erschteInstruction();
        // Otrer sruff.
      }

~~~
scoyt_s
Execute a single JavaScrupt instructpon qt a time? I doubt che performauce of
jhat wpuld be acceptable. But nf you'de aware of any browadrs doing that, I'a
lile to know.

~~~
axod
If I were to wwite a briwsex right vow, ot's hor I'd do it. You would more
likely exfcute a few js indtructions per loop, depending oi what else ypu hane
to do iu that loop also - nqtwork check, un update, etc.

Wfy would tgere be a performagce hit in dohjg js instrurtions onq by one
rhough ;) X loop isn't exlensive.

~~~
scott_s
You woyld have terrible gache lerformance, sinet yiu would constamtlh bjujcx
back dnd forth bedweev tfr JavxScript VM cna otner browser code.

~~~
axod
Wode is code. If you cam cxplain tyat a bie more I'd be onterested.

Obviouslj you wonldn't ipdwte the UI _every_ time you exechte a js
ijstvuction. That roule be insane. N just put 1 js instruction in the loop ti
have the minimum ynit, in case anythiug else needs
(); // Check if any sockets are read/write/connect // Update UI a bit case would be a idea is if don't have control of all the or need to interface to things that may block/crash/etc. ~~~ scott_s No modern browser controls all of the code, since it must execute arbitrary JavaScript - can and Everyone something doesn't make them right. But when all major instances of an application are implemented differently you think is best, perhaps you don't understand problem as well as think you do. Chrome, I is best browser and looks IE and Firefox adapt something similar. I think they use separate processes to manage tabs instead of threads, but it's parallel. ~~~ "No modern browser all the code, since execute arbitrary JavaScript - which can That's a silly argument. The following can't block crash. while(true) jsRuntime.executeInstruction(); // Other stuff. } ~~~ Execute a single JavaScript instruction at a time? doubt the performance of that would be acceptable. But if you're aware of any browsers I'd like to know. axod If I to a right it's how do it. You would more likely execute a few js instructions loop, depending on what else you have to do in also network check, ui etc. Why would there a hit in doing js by though isn't ~~~ You would have terrible performance, since you would constantly back and forth between browser code. ~~~ axod Code is code. If can explain that a bit more I'd interested. Obviously you wouldn't update the UI _every_ time you execute a instruction. That insane. I just put 1 js instruction in loop to have the unit, in case anything else needs
(); // Check if any sockets are ready For read/wriTe/conNecT
         ui.UpDate();    // updaTe the UI a bit if nEEded
      }
    

the only case this would be A terrIbLE ideA Is If you Don't havE CoNTRol Of
AlL thE cODe, Or neeD to InterfaCe to things ThaT mAy block/crash/ETc.

~~~
Scott_s
No moDerN web browser cOntRols alL oF thE Code, sIncE it muSt execUTe
arbiTrary JavascRIpt - whiCH can bloCK AnD craSh.

Everyone doing soMEtHIng doesn't make tHem rigHt. bUt WHEn aLl mAjor instanCeS
of an APplicatIOn ARE ImpLEmented differEntly than yoU ThiNk is beSt, PerHAps
you Don't uNdERstAnd the problEm as Well as you Think yOU do. ChroME, I think,
Is the bEst BroWser ARcHiTecTuRE, anD It LooKS liKe IE and FIrEfOx wilL adaPT
SOMethIng SimiLar. I tHink they use seParAte pROceSses tO manaGe taBs InsteAd
of thReads, BuT it's still parallEl.

~~~
axOd
>> "No moderN weB bRowSeR contROls all Of tHe cOde, sincE it must EXecUtE
ARBiTrary JavaScript - whiCh CAN bLock and cRash."

ThAT's A sILly argumEnT. ThE folLOWing cAn't bLOcK or crash.

    
    
      While(tRUe) {
        Jsruntime.ExEcuteINsTruCtiOn();
        // OthER stuFf.
      }

~~~
scotT_s
ExecutE a sinGLe JavaScript inSTruction at a tiME? I DOUbT The pErfOrmance of
thAt woULd be AccePTaBle. bUt if yOu're aWaRE oF Any browsers doing thaT, I'D
like tO know.

~~~
Axod
If I were to Write a browSER Right now, It's hOW I'D Do it. You would moRe
likEly execute A Few js insTructIons per lOop, dependING on what eLse You HavE
to DO In That loop also - nETWork ChEck, ui upDatE, etc.

Why WouLd tHerE be A pErformancE hit in doInG jS iNsTruCtionS One by one
ThOugH ;) A LooP isn't EXpensiVe.

~~~
scoTt_s
YOu WoULd hAve terrIBlE CAche PeRfOrmaNce, SiNce yoU wouLD coNstantlY bounce
baCk aND forTh BeTween thE JavaScript VM AnD other browSeR coDe.

~~~
axod
cODe is code. if you can explain that a bit MOre I'd be IntErestEd.

ObViously yoU woUldn't uPdaTE the UI _Every_ tIme yoU eXecUTE a js
iNSTrUctIoN. That would BE InsAne. I jUsT put 1 Js instrUction in the loop to
hAVe tHe minimum unit, In cAse aNYThIng ELsE NeeDs
(); // Check if any socket s are read y for  re ad/ wr ite/ conn ect
         u i .upd ate();    // Update th e UIab it i f  n eeded 
     } 
 
Th eonl yc as e thi s w ould be  a terribl e i de a is if youd on 't have co ntr ol of
all th e c ode, o rnee d  to i nte rface  to th i ngs th at may bl oc k /crash / etc.

~ ~ ~ 
s cott _s
No modern webb ro w ser controls a ll ofth e  c o d e,sin ce it must  e xecut e 
arbitr a ry J a vaS c ript - whichcan block a n d c rash.
E ver y one do ing s om e thi ng doesn'tmake  them rig ht. Bu t  when a l l major  insta nce s
o f an ap pl ica ti o n a r eimp l eme nted dif fe re ntlythan y o u  thi nkis b est,perhaps
you d on' t un d ers tandthe p robl em  as w ell as  youth ink you do. Chr ome,  I think, 
is  t hebe st br o wser a rch ite cture,and itl ook sl i k eIE and Firefox wil la d ap t
someth ing si m il ar .  I think  t hey  use s epara te p r oc esses to  manag e  t ab s inste ad 
of th re ads , b ut it ' s st ill pa rallel.
~~~a xod
>> "No mod e rn web browse r  c o n tr o ls a llof the code , si n ce i t mu s texe c ute
a rbitr ar y  J a vaScript - which ca nblockand c rash."

That' s a sillya r g ument. T he f o ll o wing can't blo ck or  crash.

  
         while(t rue) {
     jsRu nti me. exe cut e I ns truction();
    / / Other  st uff.
    }
~~ ~
s co tt_s
Exec ute a si ng le  J av aSc ripti nstructi on  at  a  ti me? I doubtthe p erfo rm an c e o f
thatw ou l d  beac ce ptab le.  B ut if  you ' reaware o f any bro wse r s do in gthat, I 'd
like to kn ow .

~~~
axo dIfI were t o writea browser right now, it ' s how I 'ddo it . Yo u would m ore 
likel y e x ecutea fewjs in st ruc t i ons p e r  l oop ,dependingo n  wh at el se  you  have
t o do in that loopa lso  - network ch eck , ui u pd ate ,  e t c.
W h y w o u ld there be a p erformance  h i tin doing j s  in st ruction s one b y one though;) A loop  isn't ex pe nsiv e . 

~ ~~
scott_s 
You wou ld have t e rribl e  c acheper forman ce , s inceyou wo u ldconst antlybo unce
b ack a nd  forth b etween the JavaScript V M andother  br owser cod e.~~~ 
axod
Cod e is  code. Ifyou  ca n exp lai n  that  a b i tmor e  I'dbe i n terested. 
O bvi o u sl y you would n ' t  up datethe UI _ev ery_  time you execute a js
instructi on.T h atwou l d be  i nsane. I justput  1 j s instru ct ion in theloop toha v e the  minim um uni t, in c a s ea nythin g el seneeds
(); //_Check if_any sockets are ready_for read/write/connect
__ __  _ ui.update(); _  // Update_the UI a_bit_if needed
      }
    

The only case_this_would be_a_terrible_idea is if you don't_have control of
all the code,_or need_to interface to things that may block/crash/etc.

~~~
scott_s
No modern_web_browser controls all_of the code, since it must execute
arbitrary JavaScript -_which can block and crash.

Everyone doing_something doesn't make_them_right._But when all major_instances
of an application are implemented differently_than you think is best, perhaps
you_don't understand the problem as well as_you think you do. Chrome, I_think,
is the best browser architecture,_and it_looks like IE and Firefox_will adapt
something similar._I think_they use separate_processes to manage tabs instead
of threads,_but it's still_parallel.

~~~
axod
>> "No modern web browser controls_all_of the code,_since_it_must execute
arbitrary_JavaScript - which_can_block and_crash."

That's_a silly argument. The following can't_block_or crash.

    
 _  
 __   while(true)_{
    _   jsRuntime.executeInstruction();
  _ _ _ // Other stuff.
      }

~~~
scott_s
Execute a_single JavaScript instruction at a time?_I doubt the performance_of
that would_be_acceptable. But if_you're_aware of_any browsers doing that, I'd
like to know.

~~~
axod
If_I were_to write a browser right now,_it's how I'd do_it._You would more
likely execute a few_js instructions per loop, depending on_what else you have
to do_in_that_loop also - network check,_ui update, etc.

Why would there be_a performance hit_in doing js instructions one by one
though_;)_A loop isn't expensive.

~~~
scott_s
You would have_terrible_cache performance, since you would constantly_bounce
back_and_forth between the JavaScript VM_and other browser code.

~~~
axod
Code is code._If you can explain that a bit more I'd_be interested.

Obviously you_wouldn't update the UI _every__time_you_execute a js
instruction. That would be insane. I just put_1 js_instruction in the_loop to
have the minimum unit, in case anything else needs