Skip to content

Refactor attribute_of_binary to reduce instantiation cost#66

Merged
saki7 merged 9 commits intomainfrom
refactor-attribute-of-binary
Mar 5, 2026
Merged

Refactor attribute_of_binary to reduce instantiation cost#66
saki7 merged 9 commits intomainfrom
refactor-attribute-of-binary

Conversation

@yaito3014
Copy link
Member

fixes #56

@yaito3014 yaito3014 added the enhancement New feature or request label Mar 4, 2026
@yaito3014 yaito3014 self-assigned this Mar 4, 2026
@yaito3014 yaito3014 changed the title Refactor attribute of binary Refactor attribute_of_binary Mar 4, 2026
@yaito3014 yaito3014 changed the title Refactor attribute_of_binary Refactor attribute_of_binary to reduce instantiation cost Mar 4, 2026
@cppwarningnotifier
Copy link

EnvironmentC++23C++26
x4Clang21Debug✅success✅success
Release✅success✅success
GCC14Debug✅success✅success
Release✅success✅success
MSVC2022Debug✅success✅success
Release✅success✅success
2026Debug✅success✅success
Release✅success✅success

@saki7
Copy link
Member

saki7 commented Mar 4, 2026

I'm not sure why, but it seems it's getting worse in some cases.


image
image
image

Maybe these lines should also be lightened:

using attribute_type = std::conditional_t<
is_both_same_attribute,
std::type_identity<typename parser_traits<Left>::attribute_type>,
traits::attribute_of_binary<iris::rvariant, Left, Right>
>::type;

This was part of the recent PR #55, and the PR added another complexity in the attribute type, I think.

P.S. The refactored code itself is very good, more readable for humans so it's better if we could keep the simple structure and solve the IDE heaviness at the same time.

@saki7
Copy link
Member

saki7 commented Mar 5, 2026

Still not working, but the vector<bool> case improved, so it definitely has something to do with template complexity, I guess.

To further reduce the instantiation depth, I think we should seriously start considering to drop the _t type aliases from implementation-detail metafunctions. I often see the standard library implementations do not define the _t variants for internal metafunctions, they just use ::type. From my experience it has some impact on the type expansion because type aliases appears to be treated like distinct template classes.


image
image
image

@saki7
Copy link
Member

saki7 commented Mar 5, 2026

Fixed.


image
image
image

@saki7 saki7 merged commit 9de1d0c into main Mar 5, 2026
50 checks passed
@saki7 saki7 deleted the refactor-attribute-of-binary branch March 5, 2026 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

attribute_of_binary is too heavy for IDEs to expand the actual type

2 participants