Dear community, I recently presented a calculation example with ABAP, Open SQL and ABAP CDS in this blog. It was about the different technologies that can be used to achieve the same result. I was surprised by the interest in the example. For the sake of completeness, I would now like to add a performance analysis. First, a few notes ...
The primary key of the database table ZCALC has been set to NUMC10 as data element. This allowed more test data. With a report, I generated 2,000,000 test records.

I've adjusted the code of my example a little bit and implemented the respective solutions in methods.
I carried out the runtime analysis with the transaction SAT. I focused on the runtime of operations related to internal tables and Open SQL statements. As system I used the "SAP NetWeaver Application Server for ABAP 7.52" (ASE) from the course "openSAP: Writing testable ABAP Code". The system runs via Amazon Web Services. I repeated the measurement several times. Here is the result of the last measurement.


The first "DB: Fetch ZCALC" relates to the code in method OPEN_SQL_BASED. The second "DB: Fetch ZCALC" and "Loop At IT_13" relate to the code in method ABAP_BASED.


My question to the community: Have I done the runtime measurement correctly and is this understandable? What do you think? Any comments?
Best regards, thanks for reading and please stay healthy
Michael
P.S.: Please support the virtual wishing well.
P.S.S.: Not tired of reading blogs? Check this blog by johannes_gerbershagen11. I really recommend it.
The primary key of the database table ZCALC has been set to NUMC10 as data element. This allowed more test data. With a report, I generated 2,000,000 test records.

test records
I've adjusted the code of my example a little bit and implemented the respective solutions in methods.
REPORT zcalculation_example.
CLASS lcl_calculation_example DEFINITION.
PUBLIC SECTION.
METHODS abap_based.
METHODS open_sql_based.
METHODS cds_based.
ENDCLASS.
CLASS lcl_calculation_example IMPLEMENTATION.
METHOD abap_based.
TYPES: BEGIN OF calculation,
example TYPE numc10,
summand_1 TYPE int4,
summand_2 TYPE int4,
addition_result TYPE int4,
END OF calculation.
TYPES calculations TYPE TABLE OF calculation WITH KEY example.
DATA abap_based_result TYPE calculations.
SELECT * FROM zcalc
INTO CORRESPONDING FIELDS OF TABLE abap_based_result.
LOOP AT abap_based_result ASSIGNING FIELD-SYMBOL(<row>).
<row>-addition_result = <row>-summand_1 + <row>-summand_2.
ENDLOOP.
ENDMETHOD.
METHOD open_sql_based.
SELECT example,
summand_1,
summand_2,
summand_1 + summand_2 AS addition_result
FROM zcalc
INTO TABLE @DATA(open_sql_based_result).
ENDMETHOD.
METHOD cds_based.
SELECT * FROM zcdscalc
INTO TABLE @DATA(cds_based_result).
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
DATA(example) = NEW lcl_calculation_example( ).
example->abap_based( ).
example->open_sql_based( ).
example->cds_based( ).I carried out the runtime analysis with the transaction SAT. I focused on the runtime of operations related to internal tables and Open SQL statements. As system I used the "SAP NetWeaver Application Server for ABAP 7.52" (ASE) from the course "openSAP: Writing testable ABAP Code". The system runs via Amazon Web Services. I repeated the measurement several times. Here is the result of the last measurement.

profile trace results

hitlist
The first "DB: Fetch ZCALC" relates to the code in method OPEN_SQL_BASED. The second "DB: Fetch ZCALC" and "Loop At IT_13" relate to the code in method ABAP_BASED.

database tables

database table times on ZCALC
My question to the community: Have I done the runtime measurement correctly and is this understandable? What do you think? Any comments?
Best regards, thanks for reading and please stay healthy
Michael
P.S.: Please support the virtual wishing well.
P.S.S.: Not tired of reading blogs? Check this blog by johannes_gerbershagen11. I really recommend it.