My favorites | Sign in
ect
Project Home Downloads Wiki Issues Source
Search
for
RuntimeOverhead  
Runtime overhead of programs that use ECT objects.
Featured
Updated Aug 25, 2009 by fehe...@gmail.com

You can see some research of this question in tdk2008.pdf. Some extract of this:

Fields

Time of reading and updating object fields, compared to record fields:

  • Updating record fields has < 5% overhead
  • Accessing record fields for read has < 50% overhead, in a worst-case scenario

Method calls

Method calls can be compared to several Erlang function call conventions:

  1. Module:function(Args)` - dynamic, inter-module call
  2.    Module = io,
       Module:format("hello~p", []),
    overhead: < 20%
  3. Function(Args)` - FUN-call
  4.    Function = fun(A, B) -> A+B end,
       C = Function(1, 2)
    overhead: < 150% (2.5 times slowdown)
  5. module:function(Args)` - static, inter-module call
  6.    io:format("hello~p", [])
    overhead: < 900% (10 times slowdown)

The length of inheritance chain does not affect these numbers. The reason for the results is that method calls are actually built on dynamic function calls. So if you use them where you need late binding of calls - in place of a dynamic, or a FUN call -, the price is not too big. When you do not need this, or performance is an issue, call methods like functions, or even define functions instead of methods.


Sign in to add a comment
Powered by Google Project Hosting