Thread: High-performance call to runtime target.

  1. #1
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895

    High-performance call to runtime target.

    Hi,

    Sort of an advanced request here. I have a simulation system that schedules tasks to be run at some point in the future (in iterations, not real time). The system must support calling any member function on any kind of object, and it would be nice if it supported calling any global function too. With one exception: all the called functions return void and (aside from the this pointer) take no arguments.

    I'm currently using boost::function for this, but with 10000 scheduled tasks, performance goes down the drain. Profiling shows that 80% of the time is spent in the boost::function call mechanism.

    So my question: does anyone have an idea for a high-performance calling system that can do exactly what I need, no more, no less? The system must be portable - targets include (but should not be limited to) x86, amd64, and IBM Power4 and 5 architectures. (That's two 32-bit, two 64-bit architectures, two little-endian, two big-endian, with completely different instruction sets and possibly calling conventions.)
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    I do not pretend to have an answer. However, I have been studying callback mechanisms for fun in between developing my project.
    I wasn't aware of boost::function. And as such, I have been using libsigc. http://libsigc.sourceforge.net/

    I'm very happy with it and it boosts (pun intended) a very high performance according to the authors.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #3
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Thanks for the suggestion. I will take a look at it and probably profile with it.
    As far as I can see, though, it's implemented the same way as boost::function.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  4. #4
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    If you don't mind, CornedBee, let me know what you think of it when you are done.
    Whith the newly gained realization of Boost::function (and boost::signals, btw) I would like to know an expert opinion if I should move to boost.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  2. runtime error R6025 - pure virtual function call
    By nvoigt in forum Windows Programming
    Replies: 3
    Last Post: 07-11-2004, 12:50 AM
  3. C system call and library call
    By Coconut in forum C Programming
    Replies: 6
    Last Post: 08-22-2002, 11:20 AM
  4. Assembly example
    By Lynux-Penguin in forum C Programming
    Replies: 6
    Last Post: 04-24-2002, 07:45 PM
  5. Pls help me to do this project in C I need source code
    By sureshmenon74 in forum C Programming
    Replies: 4
    Last Post: 10-04-2001, 06:57 AM