New submission from Mikhail Traskin: _dict_to_list method of the csv.DictWriter objects created with extrasaction="raise" uses look-up in the list of field names to check if current row has any unknown fields. This results in O(n^2) execution time and is very slow if there are a lot of columns in a CSV file (in hundreds or thousands). Replacing look-up in a list with a look-up in a set solves the issue (see the attached patch).
---------- components: Library (Lib) files: csvdictwriter.patch keywords: patch messages: 191197 nosy: mtraskin priority: normal severity: normal status: open title: csv.DictWriter is slow when writing files with large number of columns type: performance Added file: http://bugs.python.org/file30598/csvdictwriter.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18219> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com