Calling Internal Procedures: Performance impact? - Forum - OpenEdge Development - Progress Community

Calling Internal Procedures: Performance impact?

 Forum

Calling Internal Procedures: Performance impact?

This question is not answered

In general, are there any performance impacts of calling IPs?

All Replies
  • I would say so, but very very very very very little per call

  • perhaps you can provide a bit more background?

  • I would say measure it.  Do 1,000 or 10,000 in a loop.  

    At a these magnitude I'd guess it will start consuming a second or more of time.  It certainly isn't free since OE does a bit of work at run-time to evaluate parameters and such.  In the old days we used to put a lot of code in ABL include files so that we would avoid the run-time performance penalties of calling new procedures.

    It may depend on factors such as whether you are using "shared variables", or procedure parameters .

  • One possible issue is when passing datasets or temp-tables around. By default we pass by value which means we deep copy (clone) the data abnd this can be expensive.  We provide ways around that (by-reference, bind, etc).
     
    Other than the above I would say write your code for understandability and mantainability first, optimize later if required.

  • yes, optimization as last step.

    But up front: don't use global or shared variables :-)

  • then use a lot of IP, as they clarify programming, and when you master IP, then move to OO, lots of slower performance, but you´ll shine inside your company,,

  • test_pp_tt.p
    test_pp_tt2.p
    If you are passing TT data inside a persistent proc (between IP’s) then the TT is not passed by value.  If you pass between .P’s (and classes) then you make a deep copy. I’m not sure what happens with SUPER-PROCEDUREs.
     
    You can verify this via the TEMP-TABLES log-entry-type. See attached test code. This produces a log like the below. You can see 2 temp-tables created – one in each .P.
     
    [18/01/19@10:30:07.538-0500] P-014820 T-008476 2 4GL TEMP-TABLE     Created TEMP-TABLE ttData (ID:7 NO-UNDO Indexes:1) C:\devarea\views\pjudge_OE117\vobs_possenet\tests\test_pp_tt.p @ 34
    [18/01/19@10:30:07.538-0500] P-014820 T-008476 1 4GL APPL           IN P1
    [18/01/19@10:30:07.538-0500] P-014820 T-008476 1 4GL APPL           IN P2
    [18/01/19@10:30:07.538-0500] P-014820 T-008476 1 4GL APPL           IN P3
    [18/01/19@10:30:07.538-0500] P-014820 T-008476 1 4GL APPL           IN P4
    [18/01/19@10:30:07.554-0500] P-014820 T-008476 1 4GL APPL           NOW EXTERNAL
    [18/01/19@10:30:07.554-0500] P-014820 T-008476 2 4GL TEMP-TABLE     Created TEMP-TABLE ttData (ID:8 NO-UNDO Indexes:1) p1 test_pp_tt2.p
    [18/01/19@10:30:07.554-0500] P-014820 T-008476 1 4GL APPL           EXTERNAL START
    [18/01/19@10:30:07.554-0500] P-014820 T-008476 1 4GL APPL           EXTERNAL END
     
     
     
  • Brian, I agree and always try to balance maintainability and understanding with performance. Are you saying a call to an IP (located inside the calling procedure) still makes a copy?

  • Sorry, my question was a bit vague, wasn't it. If my .p calls and IP in the same .p, are there performance (significant) impacts? For example:

    test.p

    run mytest in this-procedure (input temp-table-cust).

    procedure mytest:

    ...

  • I was wrong about that.  Calls to either an external .p or an internal procedure of a .p which is loaded persistently will do the csopy.
     
    Sorry about that.  I shouldn’t try to do three things at a time.  :(