Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Sep 11, 2025

Summary

This PR implements the inline initiative as requested in issue #8, adding #[inline] attributes to optimize function inlining throughout the codebase.

Changes Made

🔧 Feature Configuration

  • Fixed feature name: Changed more-inline to inline-more in Cargo.toml to match issue specification
  • Updated existing attributes: Fixed existing cfg_attr directives to use the correct feature name

⚡ Inline Attributes Added

#[inline] - Obvious functions

  • try_get_link() in data/traits.rs - Simple delegation that converts Option to Result

#[inline(always)] - Hard delegations

  • constants() - All implementations that simply return &self.constants
  • count() - Simple delegation to count_by([])
  • All Box<dyn Trait> implementations - Direct delegations to the boxed value:
    • count_links()
    • create_links()
    • each_links()
    • update_links()
    • delete_links()
    • get_link()

#[cfg_attr(feature = "inline-more", inline)] - Questionable/internal functions

  • is_unused() - Internal function for checking unused links (both unit and split store)
  • exists() - Internal function for existence checks (both unit and split store)
  • get_total()/total() - Internal functions for getting total counts
  • Updated existing conditional inlines in iterator methods

Files Modified

  • doublets/Cargo.toml - Fixed feature name
  • doublets/src/data/traits.rs - Added inline attributes to trait methods and Box implementations
  • doublets/src/mem/unit/store.rs - Added inline attributes to internal helper methods
  • doublets/src/mem/split/store.rs - Added inline attributes to internal helper methods

Testing

The changes preserve all existing functionality while providing compiler hints for better inlining. The conditional inline-more feature allows users to opt into more aggressive inlining for performance-critical scenarios.

Fixes #8

🤖 Generated with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #8
@konard konard self-assigned this Sep 11, 2025
konard and others added 2 commits September 11, 2025 13:39
Implement inline initiative as requested in issue #8:

- Add #[inline] to obvious functions like try_get_link
- Add #[inline(always)] to hard delegation functions like constants(), count_links(), and Box trait implementations
- Add #[cfg_attr(feature = "inline-more", inline)] to questionable/internal functions like is_unused, exists, get_total
- Fix feature name from more-inline to inline-more in Cargo.toml
- Update existing cfg_attr directives to use correct feature name

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

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Inline initiative Add inline attributes for performance optimization Sep 11, 2025
@konard konard marked this pull request as ready for review September 11, 2025 10:45
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.

Inline initiative

2 participants