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.
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.
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:
When handling with 10 tasks: performance difference: 300 microseconds
100 tasks: approach1 is one time faster than approach2
500 tasks:
1000 tasks:
10000 tasks:
我有话说: