ABAP Internal Table Performance For STANDARD, SORTED and HASHED Table
ABAP Internal Table Performance For STANDARD, SORTED and HASHED Table
IF sy-subrc EQ 0.
"..
ENDIF.
ENDLOOP.
GET TIME STAMP FIELD lv_end_time.
lv_diff = lv_end_time - lv_sta_time.
WRITE: /(30) 'Standard Table - Binary', lv_diff.
*
*---* READ on Sorted Table
GET TIME STAMP FIELD lv_sta_time.
LOOP AT t_vbak ASSIGNING <lfs_vbak>.
READ TABLE t_sorted TRANSPORTING NO FIELDS
WITH KEY vbeln = <lfs_vbak>-vbeln.
IF sy-subrc EQ 0.
"..
ENDIF.
ENDLOOP.
GET TIME STAMP FIELD lv_end_time.
lv_diff = lv_end_time - lv_sta_time.
WRITE: /(30) 'Sorted Table', lv_diff.
*
*---* READ on HASHED table
GET TIME STAMP FIELD lv_sta_time.
LOOP AT t_vbak ASSIGNING <lfs_vbak>.
READ TABLE t_hashed TRANSPORTING NO FIELDS
WITH TABLE KEY vbeln = <lfs_vbak>-vbeln.
IF sy-subrc EQ 0.
"..
ENDIF.
ENDLOOP.
GET TIME STAMP FIELD lv_end_time.
lv_diff = lv_end_time - lv_sta_time.
WRITE: /(30) 'Hashed Table', lv_diff.
I ran the program multiple times for different set of records. Here are the average values
based on the performance readings:
And on Graph
Yet on another graph, where Standard table readings are considered at benchmark of 100. I
used average value for all other ITAB Types to show the tentative performance gain when
Using another ITAB Type other than Standard Type.
As per the above program results & graph, you should carefully decide when to use which
Table Type.