Skip to content

RM-9585 Rewrite LINQ queries using the span version of Contains - #1454

Open
a-ctor wants to merge 2 commits into
developfrom
feature/RM-9585-memory-extensions-contains
Open

a-ctor wants to merge 2 commits into
developfrom
feature/RM-9585-memory-extensions-contains

Conversation

@a-ctor

@a-ctor a-ctor commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@a-ctor
a-ctor requested a review from MichaelKetting August 28, 2026 10:18
@a-ctor a-ctor self-assigned this Aug 28, 2026
@a-ctor a-ctor changed the title Feature/rm 9585 memory extensions contains RM-9585 Rewrite LINQ queries using the span version of Contains Aug 28, 2026

@MichaelKetting MichaelKetting left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I got some simplification and a possible re-design of where the code should go. I hven't tried it. Please test.

/// While the usage get rewritten, it is also necessary to disable re-linqs evaluation as
/// it tries to constant fold the expression otherwise, which causes runtime exceptions.
/// </remarks>
public class ByRefLikeAwareEvaluatableExpressionFilter : EvaluatableExpressionFilterBase

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please create a ticket in sqlbackend. I think we should move this logic there eventually.

Comment thread Remotion/Data/DomainObjects/Queries/LinqProviderComponentFactory.cs
/// Transforms <see cref="MemoryExtensions"/>.<see cref="MemoryExtensions.Contains"/> calls generated by the C# 14 compiler back to their
/// <see cref="Enumerable"/>.<see cref="M:System.Linq.Enumerable.Contains``1(System.Collections.Generic.IEnumerable{``0},``0)"/> equivalent.
/// </summary>
public class SpanContainsExpressionTransformer : IExpressionTransformer<MethodCallExpression>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this should also go into Remotion.Linq (RMLNQ) eventually. please create a ticket

Comment thread Remotion/Data/DomainObjects/Queries/SpanContainsExpressionTransformer.cs Outdated
Comment thread Remotion/Data/DomainObjects/Queries/SpanContainsExpressionTransformer.cs Outdated
Comment thread Remotion/Data/DomainObjects/Queries/SpanContainsExpressionTransformer.cs Outdated
Comment thread Remotion/Data/DomainObjects/Queries/LinqProviderComponentFactory.cs
@MichaelKetting
MichaelKetting force-pushed the feature/RM-9585-memory-extensions-contains branch from f0126e4 to 5b1974f Compare August 28, 2026 13:52
@MichaelKetting
MichaelKetting force-pushed the feature/RM-9585-memory-extensions-contains branch from 5c26f89 to aa00675 Compare September 20, 2026 21:07
Comment thread Remotion/Data/DomainObjects/Queries/LinqProviderComponentFactory.cs Outdated

@MichaelKetting MichaelKetting left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ad discussed:
solution with new transformer doe to comaptiblity issues.
no change in re-linq right now.

Please make a ticket in RMLNQ for this.
Please add unit tests for the classes, not just the integration test.
Integration tests: please check that the "all" the classic contains keep working, too. I'm not sure how many tests we have. We should be able to simulate C#-v-old by adding COntains that are not affected by the change.

Comment thread Remotion/Data/DomainObjects/Queries/SpanContainsExpressionTransformer.cs Outdated
@a-ctor
a-ctor force-pushed the feature/RM-9585-memory-extensions-contains branch from aa00675 to 5eb6376 Compare September 30, 2026 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants