I decided to make some simple and temporal solution (but maybe permanent? :) )
In os/port/dis.c in vmachine() have static var indicates when GC was completed last time and start new routine of GC only when at least 500 msecs passed:
void vmachine(void*) { Prog *r; Osenv *o; int cycles; static ulong lastgcmsec =0; startup(); while(waserror()) { if(up->type != Interp) panic("vmachine: non-interp kproc"); if(up->iprog != nil) acquire(); if(handler(up->env->errstr) == 0) { propex(currun(), up->env->errstr); progexit(); } up->env = &up->defenv; } cycles = 0; for(;;) { if(tready(nil) == 0) { ulong now = TK2MS(MACHP(0)->ticks); if ((now - lastgcmsec) >500 /* || lowmem() */) { strcpy(up->text, "gc"); execatidle(); lastgcmsec = TK2MS(MACHP(0)->ticks); } strcpy(up->text, "idle"); sleep(&isched.irend, tready, 0); strcpy(up->text, "dis"); } if(isched.vmq != nil && (isched.runhd == nil || ++cycles > 2)){ iyield(); cycles = 0; } r = isched.runhd; if(r != nil) { o = r->osenv; up->env = o; FPrestore(&o->fpu); r->xec(r); FPsave(&o->fpu); if(isched.runhd != nil) if(r == isched.runhd) if(isched.runhd != isched.runtl) { isched.runhd = r->link; r->link = nil; isched.runtl->link = r; isched.runtl = r; } up->env = &up->defenv; if(isched.runhd != nil) { ulong now = TK2MS(MACHP(0)->ticks); if ((now - lastgcmsec) >500 /* || lowmem() */) { if (up->iprog == nil) { strcpy(up->text, "gc"); up->type = BusyGC; pushrun(up->prog); rungc(isched.head); up->type = Interp; delrunq(up->prog); strcpy(up->text, "dis"); lastgcmsec = TK2MS(MACHP(0)->ticks); } else print("up->iprog not nil (%lux)\n", up->iprog); } } } } }
That made a trick!
; time math/sieve 1000000 >/dev/null 0.01l 3.13r 3.14t
(3.14 just because it is run on Pi :) )
What is amazing is performance, comparing some 3.3GHz old Core2:
Linux mur 4.1.6-hardened #3 SMP Sun Sep 27 11:44:36 CEST 2015 i686 Intel(R) Core(TM)2 Duo CPU E8600 @ 3.33GHz GenuineIntel GNU/Linux alex@mur ~/work/pi/bb-inf-rpi/os/rpi $ emu ; time math/sieve 1000000 > /dev/null 0.014l 0.793r 0.807t
New release is coming soon! (let’s just have some little testing)
Your email is never published nor shared. Required fields are marked *
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
Performance, loop 4, solution
I decided to make some simple and temporal solution (but maybe permanent? :) )
In os/port/dis.c in vmachine() have static var indicates when GC was completed last time and start new routine of GC only when at least 500 msecs passed:
That made a trick!
(3.14 just because it is run on Pi :) )
What is amazing is performance, comparing some 3.3GHz old Core2:
New release is coming soon! (let’s just have some little testing)