Skip to content

perf: Online feature response construction in a single pass over read rows#6186

Open
ntkathole wants to merge 1 commit intofeast-dev:masterfrom
ntkathole:fused_processing_perf
Open

perf: Online feature response construction in a single pass over read rows#6186
ntkathole wants to merge 1 commit intofeast-dev:masterfrom
ntkathole:fused_processing_perf

Conversation

@ntkathole
Copy link
Copy Markdown
Member

@ntkathole ntkathole commented Mar 27, 2026

What this PR does / why we need it:

The get_online_features path uses a 3-step chain to transform raw online_read results into the protobuf response:

  • _convert_rows_to_protobuf - iterates all rows to build per-feature (timestamps, statuses, values) vectors
  • _populate_response_from_feature_data - iterates the vectors to add feature names and version metadata
  • construct_response_feature_vector - iterates again per feature to scatter values from deduplicated row positions to final output positions

Each step allocates its own intermediate lists and re-iterates the full dataset, resulting in 3x passes over the data and unnecessary memory allocations adding measurable overhead to every online serving call.

This PR replace the 3-step chain with a single fused _populate_response_from_feature_data that does everything in one pass:

  • Pre-computes timestamps once per row (not per feature)
  • Allocates output arrays directly at output_len (the final response size), eliminating intermediate vectors
  • Uses a feat_idx_map dict for O(1) feature name lookups instead of iterating per-feature per-row
  • Scatters values to their deduplicated output positions in the same loop that reads them
  • Appends FeatureVector results directly to the response proto

The function signature changes from accepting pre-processed feature_data tuples to accepting raw read_rows directly from online_read, removing the need for the intermediate _convert_rows_to_protobuf step entirely.


Open with Devin

@ntkathole ntkathole self-assigned this Mar 27, 2026
@ntkathole ntkathole requested review from a team as code owners March 27, 2026 08:45
@ntkathole ntkathole requested review from ejscribner, robhowley and tokoko and removed request for a team March 27, 2026 08:45
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review

devin-ai-integration[bot]

This comment was marked as resolved.

… rows

Signed-off-by: ntkathole <nikhilkathole2683@gmail.com>
@ntkathole ntkathole force-pushed the fused_processing_perf branch from c726abe to 2c95b00 Compare March 27, 2026 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant