That's why it's just a hack :)
I'll do something better later and post it on the main tree.
Anthony
D J G C a écrit :
OK, but from looking at the code ( I am not really into how APE's C
Source works,) , I think now, it performes 1000 times more checkes on
"are there timers finished?".
I think, if one really wants immediate async calls, they should be
handled differnt from the timers, because they have to be handled as
soon as they come, so the sockroutine should just execute all of them
immediately and leave the timer granularity at 1ms.
but thanks anywhay!
On May 22, 5:49 am, Anthony Catel <[email protected]> wrote:
I should do some test/benchmark but I think that there is no side-effect
(on Linux).
D J G C a écrit :
THANK YOU!
I got now 1.000.000 calls per second!
But what are the effects on the rest of the system?!
On May 22, 4:46 am, Anthony Catel <[email protected]> wrote:
Ok,
Here is a little hack (for APE 1.01dev) (only work on Linux, not on
BSD/OSX) :
sock.c:538-539 : change "1000" by 1 :
while (lticks >= 1) {
lticks -= 1;
process_tick(g_ape);
}
ticks.c:90 : change "msec" by "msec*1000" :
new_timer->ticks_need = msec*1000;
With that changes, 0 as a timeout value will exec the function nearly
just after :
test done in 0.01seconds
Anthony C.
Anthony Catel a écrit :
Forget. I said something stupid, 'cause the "1ms" of waiting is
proceeded after each event (that involve a Javascript call).
The internal scheme is :
loop_wait(1ms or socket data to read) {
check_for_event() { [...] Javascript_call() }
check_for_timer_queue() { timer_call() { Javascript_call() } }
}
Let me think about something :)
Anthony C.
Anthony Catel a écrit :
Indeed, it's only possible using timers.
So, yes, you must wait 1ms.
What I can suggest is an "Event queue" also called "Reactor" (see :
http://wiki.commonjs.org/wiki/Reactor/A)
For instance :
Write a function that check is there is something to call in the queue.
Call that fonction every 1ms.
When you have something async to execute, push it on the queue.
So, you can have a chance that it takes less than 1ms ;) (1ms as
worse-case).
Anthony C.
D J G C a écrit :
How can I call a function with a delay of 0 seconds and non-blocking?
Non-blocking: The statement following the function call is run
immediatly and not waiting for the function to complete!
On May 22, 3:49 am, Anthony Catel <[email protected]> wrote:
What do you mean? What kind of function?
D J G C a écrit :
Yes I thought that. But how can I make a non-blocking (asynchronous)
function call?
On May 22, 3:40 am, Anthony Catel <[email protected]> wrote:
No, it's not an issue.
The minimum value for a timer is 1ms.
10000ms = 10sec
Anthony C.
Nicolas Trani a écrit :
Hi,
there is an issue with Ape.setTimeout in APE 1.0 you
have to update to
git version.
Cheers.
On 22/05/2010 02:42, D J G C wrote:
Ape.setTimeout is extremely slow! If I call recursivly 10000
times the
same function with setTimeout it takes 10 seconds. If I call
10000 an
SQL SELECT 1 where the callback is the function itself it takes
0.9s.
is there a better way to call a function
asyncrhounsly?
This is the code to test it:
//######################## setTimeout
var start;
test();
function test(i)
{
if(i<10000)
Ape.setTimeout(test,0,i+1);
else
Ape.log("test done in "+($time()-start)/1000+ "seconds");
};
//######################## mysql
var start;
test();
function test(i)
{
if(i<10000)
sql.query("SELECT 1",function(){
test2(i+1);
});
else
Ape.log("test done in "+($time()-start)/1000+ "seconds");
};
--
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group
athttp://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website :http://www.ape-project.org/
Git Hub :http://github.com/APE-Project/
--
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group
athttp://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website :http://www.ape-project.org/
Git Hub :http://github.com/APE-Project/
--
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group
athttp://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website :http://www.ape-project.org/
Git Hub :http://github.com/APE-Project/
--
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group
athttp://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website :http://www.ape-project.org/
Git Hub :http://github.com/APE-Project/
--
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/