33% time spent in IndexedList.add()
Created originally on Bitbucket by wardi (Ian Ward)
Hello and thank you for all your work on this library! I've recently upgraded to 2.5.14 and I'm running some code that generates a 10k-line excel template for data entry and I've found that 33% of my run time is spent in IndexedList.add. I wonder if there is a problem with IndexedList or the way I'm using openpyxl.
Profiling I see most of my calls that trigger IndexedList.add come from an inner loop that styles each cell used to enter data:
xl_format = datastore_type[field['datastore_type']].xl_format
alignment = openpyxl.styles.Alignment(wrap_text=True)
protection = openpyxl.styles.Protection(locked=False)
for (c,) in sheet[validation_range]:
c.number_format = xl_format
c.alignment = alignment
c.protection = protection
where validation_range is a whole column of 10000 cells for entering data.
Is there a better way to accomplish the same thing, or is there something we can do to reduce the amount of work required by the IndexedList.add operation?