1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

Performance of OpenEdge concatenation

Discussão em 'StackOverflow' iniciado por fdantas, Novembro 12, 2017.

  1. fdantas

    fdantas Administrator Moderador

    I have noticed in Progress (10.4) that repeated string concatenation can be very slow. For example in the following code.

    DEF VAR i AS INT NO-UNDO.
    DEF VAR c AS LONGCHAR NO-UNDO.

    DO i = 1 TO 1000000:
    c = c + STRING(i MOD 10).
    END.


    From my experience in Java, I think the problem is that each time we are concatenating, we are copying c which is an O(n) operation, so the whole procedure is O(n^2). Java provides the StringBuilder class to solve this problem.

    Is my analysis of the problem correct? And if so, is there a solution?

    Continue reading...

Compartilhe esta Página