ABAP动态编程的性能开销 - Overhead of ABAP dynamic programming

作者阿里云代理 文章分类 分类:linux图文教程 阅读次数 已被围观 701

In Mytask offline performance improvement, it is necessary to support both two DDIC structure modelled in BP and Task, that is, crmt_odata_attachment_t and crmt_bp_odata_attachment_t. It is unknown which data type will be used since they are determined by runtime according to different urls passed from frontend.

The first approach to support both structure is first trying with my task structure using line ASSIGN lr_ref->* TO CASTING. If this line fails, we can know the structure does not belong to Task model, so we can use BP structure to store result.

In this approach, we have defined two variables with separate field symbol with data type crmt_odata_attachment_t and crmt_bp_odata_attachment_t to hold result.

image.png

In approach2, we use generic programming style, neither dedicated type for BP nor for Task is defined in the code. Instead, “ANY TABLE” is defined.

image.png

In ABAP help, it is said we should avoid generic programming unless it is really necessary from security and performance perspective. In this case, I would like to know the performance loss if I use approach2 compared with approach1.

Then I write the following report to get answer:

image.png


When handling with 10 tasks: performance difference: 300 microseconds

image.png


100 tasks: approach1 is one time faster than approach2

image.png


500 tasks:

image.png


1000 tasks:

image.png


10000 tasks:


image.png

 
本公司销售:阿里云、腾讯云、百度云、天翼云、金山大米云、金山企业云盘!可签订合同,开具发票。

我有话说: