Skip to content

optimize implemention of Index template to improve build speed. - #326

Merged
mavenlin merged 1 commit into
sail-sg:mainfrom
lanchihi:refine-index-template
Mar 19, 2026
Merged

optimize implemention of Index template to improve build speed.#326
mavenlin merged 1 commit into
sail-sg:mainfrom
lanchihi:refine-index-template

Conversation

@lanchihi

@lanchihi lanchihi commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

Description

Optimize implemention of Index template to improve build speed.

Motivation and Context

close #327

  • I have raised an issue to propose this change (required for new features and bug fixes)

Types of changes

What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds core functionality)
  • New environment (non-breaking change which adds 3rd-party environment)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (update in the documentation)
  • Example (update in the folder of example)

Implemented Tasks

  • Improve build speed.

Checklist

Go over all the following points, and put an x in all the boxes that apply.
If you are unsure about any of these, don't hesitate to ask. We are here to help!

  • I have read the CONTRIBUTION guide (required)
  • My change requires a change to the documentation.
  • I have updated the tests accordingly (required for a bug fix or a new feature).
  • I have updated the documentation accordingly.
  • I have reformatted the code using make format (required)
  • I have checked the code using make lint (required)
  • I have ensured make bazel-test pass. (required)

@lanchihi
lanchihi marked this pull request as ready for review March 19, 2026 10:37
@lanchihi
lanchihi force-pushed the refine-index-template branch from 2805400 to 85a297a Compare March 19, 2026 10:44
@mavenlin
mavenlin merged commit a737c8f into sail-sg:main Mar 19, 2026
0 of 4 checks passed
@Trinkle23897

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a737c8f324

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

static_assert((std::is_same_v<T, Types> || ...), "Type not found in tuple");
static constexpr std::size_t kValue = [] {
std::size_t i = 0;
((std::is_same_v<T, Types> ? false : (++i, true)) && ...);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Rewrite fold so Index does not trip clang-diagnostic-unused-value

.github/workflows/test.yml runs make clang-tidy, and .clang-tidy promotes every warning to an error (WarningsAsErrors: '*'). This fold expression now emits clang-diagnostic-unused-value for each Index<...> instantiation because the (++i, true) branch's value is discarded; I reproduced it with clang-tidy /tmp/index_test.cc -- -std=c++17 -I/workspace/envpool. Since Index is the helper behind Take() in envpool/core/dict.h, ordinary dict lookups will start failing the lint job.

Useful? React with 👍 / 👎.

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.

[Feature Request] To improve build speed

3 participants