| Author |
Message |
|
| flodis |
Posted: Fri Jan 08, 2010 6:21 am |
|
|
|
User
Joined: 09 Jul 2008
Posts: 27
|
After refactoring some of my code I noticed a huge degradation in performance.
I traced my process with dbg:tracer(), dbg:p(Pid, all) and found out that my processes triggers the code server all the time.
This happens because I have separate module which runs the process loops which does this pretty much everytime a message is received:
Code:
apply(Mod, Fun, Args)
Importing a module with functions is not really practical, is there any way I can stop my processes/code server to upgrade the code?
Code:
This is what the debug output gave me, just for one second or so:
(<0.1125.0>) code_server ! {code_call,<0.1125.0>,{ensure_loaded,living}}
(<0.1125.0>) out {code_server,call,2}
(<0.1125.0>) << {code_server,{module,living}}
(<0.1125.0>) in {code_server,call,2}
(<0.1125.0>) code_server ! {code_call,<0.1125.0>,{ensure_loaded,robot}}
(<0.1125.0>) out {code_server,call,2}
(<0.1125.0>) << {code_server,{module,robot}}
(<0.1125.0>) in {code_server,call,2}
(<0.1125.0>) code_server ! {code_call,<0.1125.0>,{ensure_loaded,npc}}
(<0.1125.0>) out {code_server,call,2}
(<0.1125.0>) << {code_server,{module,npc}}
(<0.1125.0>) in {code_server,call,2}
(<0.1125.0>) code_server ! {code_call,<0.1125.0>,{ensure_loaded,living}}
(<0.1125.0>) out {code_server,call,2}
(<0.1125.0>) << {code_server,{module,living}}
(<0.1125.0>) in {code_server,call,2}
(<0.1125.0>) code_server ! {code_call,<0.1125.0>,{ensure_loaded,movable}}
(<0.1125.0>) out {code_server,call,2}
(<0.1125.0>) << {code_server,{module,movable}}
(<0.1125.0>) in {code_server,call,2}
(<0.1125.0>) code_server ! {code_call,<0.1125.0>,{ensure_loaded,robot}}
(<0.1125.0>) out {code_server,call,2}
(<0.1125.0>) << {code_server,{module,robot}}
(<0.1125.0>) in {code_server,call,2}
(<0.1125.0>) code_server ! {code_call,<0.1125.0>,{ensure_loaded,npc}}
(<0.1125.0>) out {code_server,call,2}
(<0.1125.0>) << {code_server,{module,npc}}
(<0.1125.0>) in {code_server,call,2}
(<0.1125.0>) code_server ! {code_call,<0.1125.0>,{ensure_loaded,living}}
(<0.1125.0>) out {code_server,call,2}
(<0.1125.0>) << {code_server,{module,living}}
(<0.1125.0>) in {code_server,call,2}
(<0.1125.0>) code_server ! {code_call,<0.1125.0>,{ensure_loaded,robot}}
(<0.1125.0>) out {code_server,call,2}
(<0.1125.0>) << {code_server,{module,robot}}
(<0.1125.0>) in {code_server,call,2}
(<0.1125.0>) code_server ! {code_call,<0.1125.0>,{ensure_loaded,npc}}
(<0.1125.0>) out {code_server,call,2}
(<0.1125.0>) << {code_server,{module,npc}}
(<0.1125.0>) in {code_server,call,2}
(<0.1125.0>) code_server ! {code_call,<0.1125.0>,{ensure_loaded,living}}
(<0.1125.0>) out {code_server,call,2}
(<0.1125.0>) << {code_server,{module,living}}
(<0.1125.0>) in {code_server,call,2}
(<0.1125.0>) code_server ! {code_call,<0.1125.0>,{ensure_loaded,movable}}
(<0.1125.0>) out {code_server,call,2}
(<0.1125.0>) << {code_server,{module,movable}}
(<0.1125.0>) in {code_server,call,2}
(<0.1125.0>) code_server ! {code_call,<0.1125.0>,{ensure_loaded,robot}}
(<0.1125.0>) out {code_server,call,2}
(<0.1125.0>) << {code_server,{module,robot}}
(<0.1125.0>) in {code_server,call,2}
(<0.1125.0>) code_server ! {code_call,<0.1125.0>,{ensure_loaded,npc}}
(<0.1125.0>) out {code_server,call,2}
(<0.1125.0>) << {code_server,{module,npc}}
(<0.1125.0>) in {code_server,call,2}
(<0.1125.0>) code_server ! {code_call,<0.1125.0>,{ensure_loaded,living}}
(<0.1125.0>) out {code_server,call,2}
(<0.1125.0>) << {code_server,{module,living}}
(<0.1125.0>) in {code_server,call,2}
(<0.1125.0>) code_server ! {code_call,<0.1125.0>,{ensure_loaded,robot}}
(<0.1125.0>) out {code_server,call,2}
(<0.1125.0>) << {code_server,{module,robot}}
(<0.1125.0>) in {code_server,call,2}
(<0.1125.0>) code_server ! {code_call,<0.1125.0>,{ensure_loaded,npc}}
(<0.1125.0>) out {code_server,call,2}
(<0.1125.0>) << {code_server,{module,npc}}
(<0.1125.0>) in {code_server,call,2}
(<0.1125.0>) code_server ! {code_call,<0.1125.0>,{ensure_loaded,living}}
(<0.1125.0>) out {code_server,call,2}
(<0.1125.0>) << {code_server,{module,living}}
(<0.1125.0>) in {code_server,call,2}
(<0.1125.0>) code_server ! {code_call,<0.1125.0>,{ensure_loaded,movable}}
(<0.1125.0>) out {code_server,call,2}
(<0.1125.0>) << {code_server,{module,movable}}
(<0.1125.0>) in {code_server,call,2}
(<0.1125.0>) gc_start [{old_heap_block_size,610},
{heap_block_size,987},
{mbuf_size,17},
{recent_size,70},
{stack_size,25},
{old_heap_size,224},
{heap_size,962}]
(<0.1125.0>) gc_end [{old_heap_block_size,610},
{heap_block_size,1597},
{mbuf_size,0},
{recent_size,0},
{stack_size,25},
{old_heap_size,273},
{heap_size,36}]
(<0.1125.0>) out {obj_loop,loop,1}
|
|
|
| Back to top |
|
| uwiger |
Posted: Fri Jan 08, 2010 8:36 am |
|
|
|
User
Joined: 03 Jul 2006
Posts: 604
Location: Sweden
|
flodis wrote: I traced my process with dbg:tracer(), dbg:p(Pid, all) and found out that my processes triggers the code server all the time.
This happens because I have separate module which runs the process loops which does this pretty much everytime a message is received:
Code:
apply(Mod, Fun, Args)
Are you sure the functions you're calling actually exist?
The function apply/3 doesn't call ensure_loaded, but the error_handler does, in response to an 'undef' exception (since this can be due to the module not yet being loaded). Thus, it is reasonable to see this the first time, but if it happens every time, either the module can't be loaded, or the function you are trying to call doesn't exist in that module.
You can investigate this by running an exception trace on the modules in question. |
_________________ http://www.erlang-consulting.com |
|
| Back to top |
|
| flodis |
Posted: Mon Jan 11, 2010 8:30 pm |
|
|
|
User
Joined: 09 Jul 2008
Posts: 27
|
Thanks for the reply. The reason for the numerous calls to the code servers whas that I was using the experimental inheritance -extends().
It seems like doing an apply on an inherited function did work but triggered the code server.
Now I have implemented an inheritance system of my own which seems to work fine. |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|