mattia / pagure

Forked from pagure 3 years ago
Clone

b68dfe1 Make patch_to_diff use lists instead of string concatenation

Authored and Committed by puiterwijk 6 years ago
    Make patch_to_diff use lists instead of string concatenation
    
    String concatenation is *very* inefficient in Python (and most languages) due to
    the constant reallocation of the same memory block.
    Instead, let's just build up the full diff in a list of strings, which we then
    concatenate in a single time.
    
    On my laptop, this speeds up the viewing of a particular semi-large diff from
    over three minutes to just two seconds.
    
    Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
    
        
file modified
+7 -6