Skip to content

Commit b192ca5

Browse files
Copilotmykaul
andcommitted
Add detailed comments explaining the optimization benefits
Co-authored-by: mykaul <[email protected]>
1 parent 2fc623a commit b192ca5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cassandra/protocol.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -720,9 +720,11 @@ def recv_results_rows(self, f, protocol_version, user_type_map, result_metadata,
720720
self.column_types = [c[3] for c in column_metadata]
721721
col_descs = [ColDesc(md[0], md[1], md[2]) for md in column_metadata]
722722

723-
# Optimize by checking column_encryption_policy once and creating appropriate decode path
723+
# Optimize by checking column_encryption_policy once and creating appropriate decode path.
724+
# This avoids checking the policy for every single value decoded (rows × columns times).
724725
if column_encryption_policy:
725-
# Pre-compute encryption info for each column to avoid repeated lookups
726+
# Pre-compute encryption info for each column to avoid repeated lookups.
727+
# For N rows with M columns, this reduces contains_column() calls from N×M to just M.
726728
column_encryption_info = [
727729
(column_encryption_policy.contains_column(col_desc), col_desc)
728730
for col_desc in col_descs

0 commit comments

Comments
 (0)