User bio
404 bio not found
Member since Jun 2, 2017
Replies:

Of the three options presented already, concatenating with $LISTBUILD() is by far the most performant. Running the following method

ClassMethod ListTest(l = 100000)
{
    #; Concatenate with $LISTBUILD
    Set li="",zh=$ZHOROLOG
    For i=1:1:l Set li=li_$LISTBUILD(i)
    Write "Creating a list with length of ",$LISTLENGTH(li)," using $LISTBUILD() took ",$ZHOROLOG-zh," seconds",!
    #; Set $LIST
    Set li="",zh=$ZHOROLOG
    For i=1:1:l Set $LIST(li,i)=i
    Write "Creating a list with length of ",$LISTLENGTH(li)," using $LIST() took ",$ZHOROLOG-zh," seconds",!
    #; $LISTUPDATE
    Set li="",zh=$ZHOROLOG
    For i=1:1:l Set li=$LISTUPDATE(li,i,i)
    Write "Creating a list with length of ",$LISTLENGTH(li)," using $LISTUPDATE took ",$ZHOROLOG-zh," seconds"
}

on a recent version of IRIS produces these results:

USER>d ##class(User.Test).ListTest()
Creating a list with length of 100000 using $LISTBUILD() took .007244 seconds
Creating a list with length of 100000 using $LIST() took 10.156168 seconds
Creating a list with length of 100000 using $LISTUPDATE took 10.954107 seconds
Certifications & Credly badges:
Brett has no Certifications & Credly badges yet.
Global Masters badges:
Brett has no Global Masters badges yet.
Followers:
Following:
Brett has not followed anybody yet.