几种ABAP内表访问性能比较

简介: 几种ABAP内表访问性能比较

REPORT  Z_ABAP_JERRY.

PARAMETERS entries TYPE i DEFAULT 100.

DATA:

     itab_standard TYPE STANDARD TABLE OF i WITH KEY table_line,

     itab_sorted TYPE SORTED TABLE OF i WITH UNIQUE KEY table_line,

     itab_hashed TYPE HASHED TABLE OF i WITH UNIQUE KEY table_line.

DATA:

     t1 TYPE i,

     t2 TYPE i.

*Fill tables

WRITE: / 'Fill tables'.

GET RUN TIME FIELD t1.

DO entries TIMES.

 APPEND sy-index TO itab_standard.

ENDDO.

GET RUN TIME FIELD t2.

t2 = t2 - t1.

WRITE: / 'Runtime consumed by standard table is', t2.

"sort itab_standard.

"DELETE ADJACENT DUPLICATES FROM ...

GET RUN TIME FIELD t1.

DO entries TIMES.

 INSERT sy-index INTO TABLE itab_sorted.

ENDDO.

GET RUN TIME FIELD t2.

t2 = t2 - t1.

WRITE: / 'Runtime consumed by sorted table is', t2.

GET RUN TIME FIELD t1.

DO entries TIMES.

 insert sy-index into table itab_hashed.

ENDDO.

GET RUN TIME FIELD t2.

t2 = t2 - t1.

WRITE: / 'Runtime consumed by hashed table is', t2.

*Read with key

WRITE: /.

WRITE: / 'Read tables with key'.

GET RUN TIME FIELD t1.

DO entries TIMES.

 READ TABLE itab_standard WITH TABLE KEY table_line = sy-index TRANSPORTING NO FIELDS.

 "sy-subrc

ENDDO.

GET RUN TIME FIELD t2.

t2 = t2 - t1.

WRITE: / 'Runtime consumed by standard table is', t2.

GET RUN TIME FIELD t1.

DO entries TIMES.

 READ TABLE itab_sorted WITH TABLE KEY table_line = sy-index TRANSPORTING NO FIELDS.

ENDDO.

GET RUN TIME FIELD t2.

t2 = t2 - t1.

WRITE: / 'Runtime consumed by sorted table is', t2.

GET RUN TIME FIELD t1.

DO entries TIMES.

 READ TABLE itab_hashed WITH TABLE KEY table_line = sy-index TRANSPORTING NO FIELDS.

ENDDO.

GET RUN TIME FIELD t2.

t2 = t2 - t1.

WRITE: / 'Runtime consumed by hashed table is', t2.

*Read with index

WRITE: /.

WRITE: / 'Read tables with index'.

GET RUN TIME FIELD t1.

DO entries TIMES.

 READ TABLE itab_standard INDEX sy-index TRANSPORTING NO FIELDS.

ENDDO.

GET RUN TIME FIELD t2.

t2 = t2 - t1.

WRITE: / 'Runtime consumed by standard table is', t2.

GET RUN TIME FIELD t1.

DO entries TIMES.

 READ TABLE itab_sorted INDEX sy-index TRANSPORTING NO FIELDS.

ENDDO.

GET RUN TIME FIELD t2.

t2 = t2 - t1.

WRITE: / 'Runtime consumed by sorted table is', t2.

相关文章
|
8月前
使用 SAP ABAP 封装的 Office Integration class 访问本地 Excel 文件
使用 SAP ABAP 封装的 Office Integration class 访问本地 Excel 文件
48 0
|
19天前
|
存储 前端开发 Linux
在 SAP ABAP 系统里访问 FTP 服务器
在 SAP ABAP 系统里访问 FTP 服务器
20 0
|
19天前
|
数据处理 自然语言处理 BI
ABAP 源代码如何创建嵌套的内表,即内表列数据结构又是内表
ABAP 源代码如何创建嵌套的内表,即内表列数据结构又是内表
28 1
|
19天前
|
SQL Java 数据库
ABAP 7.40 新语法介绍系列之四 - ABAP Table Expression 内表表达式的用法试读版
ABAP 7.40 新语法介绍系列之四 - ABAP Table Expression 内表表达式的用法试读版
20 0
SAP ABAP 内表排序 动态字段排序
对于动态内表排序引用ABAP_SORTORDER_TAB
238 0
|
8月前
|
大数据 测试技术
关于 ABAP 函数调用 Pass by value 和 Pass by reference 的性能比较
关于 ABAP 函数调用 Pass by value 和 Pass by reference 的性能比较
79 1
|
8月前
|
存储 BI 数据库
使用 FOR ALL ENTRIES 将 ABAP 内表内容作为数据库表的读取条件之一试读版
使用 FOR ALL ENTRIES 将 ABAP 内表内容作为数据库表的读取条件之一试读版
52 0
|
8月前
|
API
使用 SAP ABAP API 读取内表变量占用的 ABAP 内存空间大小
使用 SAP ABAP API 读取内表变量占用的 ABAP 内存空间大小
59 0
|
8月前
|
存储
将 SAP ABAP 内表内容本地导出成 Excel 文件试读版
将 SAP ABAP 内表内容本地导出成 Excel 文件试读版
51 0
|
9月前
|
Web App开发 测试技术 开发者
几种 SAP ABAP OData 服务的性能评估和测试工具介绍试读版
几种 SAP ABAP OData 服务的性能评估和测试工具介绍试读版
72 0