技术开发 频道

ABAP性能实例七例

    七、Character/String Manipulation

    1.fixed and unfixed length strings

    字符串连接运算Concatenate需要扫描固定长度字符(fixed character fields)从第一个非空字符到最后。由于依赖于字符字段的长度,字符串string操作可能更快些。

    *data c1(200) type c.

    *data c2(200) type c.

    *data c3(400) type c.
    

    c1 = 'mysap'.

    c2 = '.com'.

    concatenate c1 c2 into c3.
    

    *data string1 type string.

    *data string2 type string.

    *data string3 type string.
    

    string1 = 'mysap'.

    string2 = '.com'.

    concatenate string1 string2 into string3.
    

    八、ABAP Objects

    1.Methods vs Subroutines

    调用本地方法PERORM和调用本地子程序CALL性能上没有差异。

    2.Methods vs Function Modules

    调用全局类(Global Classes)比调用Function Modules要快

    call function 'FUNCTION1'.

    call method CL_PERFORMANCE_TEST=>M1.

    3.Local Methods vs global Methods

    调用全局方法不比调用本地方法要慢多少.

    call method C1=>M1.  “Local

    call method CL_PERFORMANCE_TEST=>M1.   “Global

0
相关文章