re: call vs c_func/c_proc with asm
- Posted by Daniel Kluss <codepilot at gmail.com> Dec 28, 2005
- 454 views
Now the last test causes an error, but it really shouldn't Please tell me why, the only reason I can see is, prehaps c_func/proc make some sort of preperations for euphoria being called back, but call doesn't. Dan
include machine.e include dll.e constant ret=allocate_string({#C3}), ret_=define_c_proc({},ret,{}) atom t,a,at procedure eret() end procedure constant eret_=routine_id("eret") a=0 t=time() for i = 1 to 100000000 do a+=1 end for ? time()-t at=time()-t--0.91 a=0 t=time() for i = 1 to 100000000 do a+=1 call(ret) end for ? time()-t-at--0.48 a=0 t=time() for i = 1 to 100000000 do a+=1 c_proc(ret_,{}) end for ? time()-t-at--4.21 a=0 t=time() for i = 1 to 100000000 do a+=1 eret() end for ? time()-t-at--2.2 a=0 t=time() for i = 1 to 100000000 do a+=1 call_proc(eret_,{}) end for ? time()-t-at--4.04 integer rv function fret() return 0 end function constant fret_=routine_id("fret") constant fret_cb=call_back(fret_) constant fret_cp=define_c_proc({},fret_cb,{}) constant fret_cf=define_c_func({},fret_cb,{},C_UINT) a=0 t=time() for i = 1 to 100000000 do a+=1 rv=fret() end for ? time()-t-at--2.2 a=0 t=time() for i = 1 to 100000000 do a+=1 rv=call_func(fret_,{}) end for ? time()-t-at--4.04 a=0 t=time() for i = 1 to 100000000 do a+=1 rv=c_func(fret_cf,{}) end for ? time()-t-at--4.04 a=0 t=time() for i = 1 to 100000000 do a+=1 c_proc(fret_cp,{}) end for ? time()-t-at--4.04 a=0 t=time() for i = 1 to 100000000 do a+=1 call(fret_cb) end for ? time()-t-at--4.04 ? 1/0