Skip to content

Conversation

@theronic
Copy link
Owner

This commit makes two improvements to the indexed implementation:

  1. Performance optimization: Replace destructuring with direct nth access

    • extract-resource-id-from-rel-tuple-datom now uses nth for speed
    • extract-subject-id-from-reverse-rel-tuple-datom now uses nth for speed
    • Added docstrings documenting tuple formats for clarity
  2. Semantic clarity: Use correct extraction function for reverse lookups

    • can? function now uses extract-subject-id-from-reverse-rel-tuple-datom for reverse index lookups (lines 258 and 275)
    • While both functions extract from position 4, using the semantically correct function makes the code intent clearer and more maintainable

Note: Both tuple formats have the desired eid at position 4, so this change improves code clarity without fixing an actual bug.

🤖 Generated with Claude Code

This commit makes two improvements to the indexed implementation:

1. Performance optimization: Replace destructuring with direct nth access
   - extract-resource-id-from-rel-tuple-datom now uses nth for speed
   - extract-subject-id-from-reverse-rel-tuple-datom now uses nth for speed
   - Added docstrings documenting tuple formats for clarity

2. Semantic clarity: Use correct extraction function for reverse lookups
   - can? function now uses extract-subject-id-from-reverse-rel-tuple-datom
     for reverse index lookups (lines 258 and 275)
   - While both functions extract from position 4, using the semantically
     correct function makes the code intent clearer and more maintainable

Note: Both tuple formats have the desired eid at position 4, so this
change improves code clarity without fixing an actual bug.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
reverse-end [resource-type resource-eid via-relation intermediate-type Long/MAX_VALUE]
intermediates (->> (d/index-range db reverse-tuple-attr reverse-start reverse-end)
(map extract-resource-id-from-rel-tuple-datom))] ; Extract subject (intermediate) eid
(map extract-subject-id-from-reverse-rel-tuple-datom))] ; Extract subject (intermediate) eid
Copy link
Owner Author

Choose a reason for hiding this comment

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

this was incidentally correct before (just made it explicit)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants