Ticket #160 (closed enhancement: fixed)

Opened 10 months ago

Last modified 2 months ago

Small optimization to Table._markColumnsAsDirty()

Reported by: ivilata Owned by: somebody
Priority: trivial Component: PyTables Pro
Version: Keywords: _markColumnsAsDirty optimization dirty columns
Cc:

Description

The following patch avoids Table._markColumnsAsDirty() iterating over all columns. Instead, it only iterates over updated columns:

--- tables/table.py	(revision 3513)
+++ tables/table.py	(working copy)
@@ -2136,10 +2136,11 @@
         """Mark column indexes in `colnames` as dirty."""
 
         if self.indexed:
+            colindexed, cols = self.colindexed, self.cols
             # Mark the proper indexes as dirty
-            for (colname, colindexed) in self.colindexed.iteritems():
-                if colindexed and colname in colnames:
-                    col = self.cols._g_col(colname)
+            for colname in colnames:
+                if colindexed[colname]:
+                    col = cols._g_col(colname)
                     col.index.dirty = True

This is valid for trunk and 2.0.

Change History

Changed 2 months ago by faltet

  • status changed from new to closed
  • resolution set to fixed

Applied in r3857 (pro-trunk) and r3858 (backported to std-trunk). Thanks!

Closing this ticket.

Note: See TracTickets for help on using tickets.