Skip to content

Remove std::optional, use enum values to represent optional piece, color, etc... #94

@Hardcode3

Description

@Hardcode3

🎯 Goal

Remove std::optional feature from the codebase in legal move generation (hot path) to optimize a bit the engine.

🧠 Key Idea / Logic

std::optional is a recent c++ feature, allowing to make a variable optional.

However, its presence in hot paths slows the engine down.

🛠️ Tasks

  • Benchmark the engine before the update
  • Create new enum vales representing defaults (invalid state): Piece::NO_PIECE, Color::NO_COLOR
  • Remove occurences of std::optional
  • Benchmark the engine after the update

✅ Acceptance Criteria

  • Full test suite is passing
  • Engine must be slightly faster

📝 Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    perfPerformance related stuff.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions