bugGNU Octave - Bugs: bug #59679, Overhead in calling function...

 
 

bug #59679: Overhead in calling function handles

Submitted by:  None
Submitted on:  Mon 14 Dec 2020 06:18:09 AM UTC  
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Performance
Status:  Need Info Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  Open Release:  dev
Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 21 Dec 2020 11:33:49 AM UTC, comment #5: 

I applied your patch on top of hg id 649920d8a5bf and tried to build.
But linking fails with the following error:

/usr/bin/ld: libinterp/.libs/liboctinterp.so: undefined reference to `octave_fcn_handle::call(int, octave_value_list const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:15912: src/octave-cli] Error 1

Markus Mützel <mmuetzel>
Project Member
Tue 15 Dec 2020 05:36:09 AM UTC, comment #4: 

Oops , sorry! I made a mistake!
feval correctly executes the 'call' method of the m_fcn member of the function handle so my previous comments are invalid. But I attached a patch (bug59679.patch) that improves calling function handles by feval. For example when calling feval this way:

s=@sum;
out = feval (s,[1,2,3]);

(file #50467)

Anonymous
Mon 14 Dec 2020 10:21:53 PM UTC, comment #3: 

Can you prepare a patch?  While it seems that this should be more efficient, the only way to know for sure is to test which may reveal that the savings are small.

Rik <rik5>
Project Administrator
Mon 14 Dec 2020 04:08:47 PM UTC, comment #2: 

If 'handle' is defined to be a function handle then 'm_fcn' should be a function and every function has a 'call' method.
In the call method of 'handle' if 'm_fcn' isn't a function an error is generated.
Dispatching to the correct class method I think is completely manipulated in other methods of 'handle'.

Anonymous
Mon 14 Dec 2020 12:13:21 PM UTC, comment #1: 

Would that approach dispatch to the correct class method?

Markus Mützel <mmuetzel>
Project Member
Mon 14 Dec 2020 06:18:09 AM UTC, original submission:  

Currently calling a function handle follows these simplified steps:

handle.subsref (arglist) -->

  handle.call (auto& args=arglist.front ()) -->

    feval (handle.m_fcn, args) -->

      handle.m_fcn.subsref (arglist=make_list (args)) -->

        handle.m_fcn.call (arglist.front ())

It may be more efficient to follow these steps:

handle.subsref (arglist) -->

  handle.call (auto& args=arglist.front ()) -->

    handle.m_fcn.call (args)

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #50467:  bug59679.patch added by None (854B - application/octet-stream - calling function handles by feval improved)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mmuetzel (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-12-21 mmuetzel Release6.1.0 => dev
    2020-12-15 None Attached File- => Added bug59679.patch, #50467
    2020-12-14 mmuetzel StatusNone => Need Info

    Back to the top


    Powered by Savane 3.5