All was able to get the script 20% improvement, seems the sys.stdout.writelines takes the longest. Not sure if it can be enhanced for speed in case larger files come.
Dave
Dave
import difflib import concurrent.futures import sys import time import os fromfile = "some20MB.dat" tofile = "another20MB.dat" fromlines = open(fromfile, "r").readlines() tolines = open(tofile, "r").readlines() with concurrent.futures.ProcessPoolExecutor() as executor: diff = difflib.HtmlDiff().make_file(fromlines,tolines,fromfile,tofile) with concurrent.futures.ProcessPoolExecutor() as executor: sys.stdout.writelines(diff)