Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use [Channel1_Stem1] pattern for Stem COs. Improve speed a bit. #14244

Merged
merged 2 commits into from
Jan 30, 2025

Conversation

daschuer
Copy link
Member

Fixes #14240 for a consistent rule how indexed groups are build.

@Eve00000
Copy link
Contributor

I've added a request on # 14240 regarding
eg [QuickEffectRackX_[ChannelYStemZ]] -> [QuickEffectRackX_ChannelY_StemZ]
eg [EqualizerRackX_[ChannelY]_EffectZ] -> [EqualizerRackX_ChannelY_EffectZ]

src/engine/channels/enginedeck.cpp Outdated Show resolved Hide resolved
src/engine/channels/enginedeck.h Outdated Show resolved Hide resolved
@acolombier
Copy link
Member

I've added a request on # 14240 regarding
eg [QuickEffectRackX_[ChannelYStemZ]] -> [QuickEffectRackX_ChannelY_StemZ]
eg [EqualizerRackX_[ChannelY]_EffectZ] -> [EqualizerRackX_ChannelY_EffectZ]

This should be updated as well IMO

@Holzhaus
Copy link
Member

I've added a request on # 14240 regarding
eg [QuickEffectRackX_[ChannelYStemZ]] -> [QuickEffectRackX_ChannelY_StemZ]
eg [EqualizerRackX_[ChannelY]_EffectZ] -> [EqualizerRackX_ChannelY_EffectZ]

This should be updated as well IMO

This is an entirely different topic IMHO. We would change the legacy naming names since Mixxx 2.0. Let's please please not conflate these topics and discuss this separately.

Comment on lines 360 to 362
QString EngineDeck::getGroupForStem(const QString& deckGroup, int stemIdx) {
DEBUG_ASSERT(deckGroup.endsWith("]") && stemIdx < 4);
QString stemGroup =
QStringView(deckGroup.constData(), deckGroup.size() - 1) +
QStringLiteral("_Stem0]");
stemGroup[stemGroup.size() - 2] = QChar('1' + static_cast<char>(stemIdx));
return stemGroup;
return QStringView(deckGroup.constData(), deckGroup.size() - 1) +
Copy link
Member

Choose a reason for hiding this comment

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

last nitpick:

QString EngineDeck::getGroupForStem(QStringView deckGroup, int stemIdx) {
    DEBUG_ASSERT(stemIdx < 4);
    DEBUG_ASSERT(deckGroup.endsWith(QChar(']')));
    return deckgroup.chopped(1) +

Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunatly this comes witha a runtime overhead. Unlike QStringView(deckGroup.constData(), deckGroup.size() - 1), deckgroup.chopped(1) retuns a new allocated QString. It basically boils down to QString(deckGroup.constData(), deckGroup.size() - 1).

Just learned that that since 6.8 there is a QString chopped() && that will not introduce a new string when used on an rval
std::move(deckGroup).chopped(1)
but we have only a const QString&

Copy link
Member

@Swiftb0y Swiftb0y Jan 29, 2025

Choose a reason for hiding this comment

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

deckgroup.chopped(1) retuns a new allocated QString

Yes, but since my proposal also makes deckGroup a QStringView, the concern doesn't apply. If we know we don't need to store the string we should generally start taking QStringViews instead of const QString&s IMO. This is a perfect example of a "leaf" function where we know no inner function needs a proper QString so this is the place to start such as refactoring.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah I see. Good idea.

@daschuer
Copy link
Member Author

Committed suggestion and squashed history. Thank you for review.

Copy link
Member

@Swiftb0y Swiftb0y left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you.

@Swiftb0y Swiftb0y merged commit adda147 into mixxxdj:main Jan 30, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Channel1Stem1] -> [Channel1_Stem1]
5 participants