1. A method implemented by a computing device, the method comprising: obtaining a video timeline by the computing device comprising a plurality of video elements of a video sequence; generating an array of data by the computing device comprising compositing instructions for each of the video elements arranged within the array according to the timeline; obtaining a plurality of array patterns by the computing device having a predefined order, each of the array patterns comprising a relationship between the compositing instructions; performing, by the computing device, in the predefined order for each of the plurality of array patterns, operations comprising: obtaining the array pattern by the computing device; determining by the computing device that two or more sections of the compositing instructions of the array match the array pattern; and responsive to determining that the sections of the array match the array pattern, replacing the sections of the array by the computing device with a modified section comprising modified compositing instructions corresponding to the pattern, the replacing effective to create a modified array of data with less items than the array; and responsive to the operations being performed for the plurality of array patterns, compositing a frame of the video sequence by the computing device according to the modified array.