octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #62006] High function calling overhead


From: Rik
Subject: [Octave-bug-tracker] [bug #62006] High function calling overhead
Date: Tue, 8 Feb 2022 01:15:00 -0500 (EST)

URL:
  <https://savannah.gnu.org/bugs/?62006>

                 Summary: High function calling overhead
                 Project: GNU Octave
            Submitted by: rik5
            Submitted on: Mon 07 Feb 2022 10:14:58 PM PST
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Performance
                  Status: Confirmed
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: dev
         Discussion Lock: Any
        Operating System: GNU/Linux

    _______________________________________________________

Details:

I used the following script to benchmark the calling overhead in Octave.


N = 1e6;

tic;
for i = 1:N
  ## Empty for loop body 
endfor
bm1 = toc

function NOP ()
endfunction

tic;
for i = 1:N
  ## Call NOP subfunction
  NOP ();
endfor
bm2 = toc

tic;
for i = 1:N
  ## Call C++ emptyoct function
  emptyoct();
endfor
bm3 = toc


The accompanying emptyoct.cc file is


#include <octave/oct.h>

DEFUN_DLD (emptyoct, args, nargout,
           "emptyoct does nothing, and should be fast")
{
  return ovl (octave_value ());
}


The results were


bm1 = 0.074267
bm2 = 2.2344
bm3 = 1.2721


Even with C++ there is a fair amount of overhead.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Mon 07 Feb 2022 10:14:58 PM PST  Name: bm_fcn_call_overhead.m  Size:
253B   By: rik5

<http://savannah.gnu.org/bugs/download.php?file_id=52822>
-------------------------------------------------------
Date: Mon 07 Feb 2022 10:14:58 PM PST  Name: emptyoct.cc  Size: 153B   By:
rik5

<http://savannah.gnu.org/bugs/download.php?file_id=52823>

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?62006>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]