Skip to content

Conversation

@bazsi
Copy link
Member

@bazsi bazsi commented Nov 30, 2025

Instead of having to clone, merge and then unref, this allows us to mutate dicts in place using the "+=" operator.

@bazsi bazsi force-pushed the filterx-inplace-add-for-improved-performance branch 2 times, most recently from b63ba85 to 5db1d15 Compare November 30, 2025 21:48
@bazsi bazsi force-pushed the filterx-inplace-add-for-improved-performance branch from 5db1d15 to 97edbb8 Compare December 7, 2025 22:01
@bazsi bazsi mentioned this pull request Dec 7, 2025
{
FilterXOperatorPlusAssign *self = g_new0(FilterXOperatorPlusAssign, 1);
filterx_binary_op_init_instance(&self->super, "plus-assign", lhs, rhs);
self->super.super.eval = _eval_plus_assign;
Copy link
Member

Choose a reason for hiding this comment

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

Don't we need ignore_falsy_result = TRUE?

}

static FilterXObject *
_add_inplace(FilterXObject *lhs_object, FilterXObject *rhs_object)
Copy link
Member

Choose a reason for hiding this comment

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

Can we do the same for sequence?

@bazsi bazsi force-pushed the filterx-inplace-add-for-improved-performance branch 2 times, most recently from eb7e6f4 to f771f97 Compare January 30, 2026 08:05
bazsi added 5 commits February 9, 2026 13:33
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
…ject_add_object()

The subject of all FilterXObject methods is an object anyway, so
it does not add much value and is inconsistent.

Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
The new method should perform changes on @self and return a ref to self if
it was successful.  If in-place addition fails for some reason, it can
return an alternative object.

Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
The FilterXRef object can absorb the returned valule by add_inplace().  If
the value is the same object (e.g.  inplace add was successful), we just
return the same ref. If it was changed, then self->value is updated.

Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
… one

Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
@bazsi bazsi force-pushed the filterx-inplace-add-for-improved-performance branch from f771f97 to 0af5515 Compare February 10, 2026 07:45
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
…d goto

This time, it is easier to just use an else block.

Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Instead of an ugly `add_mode` property, use a specific method.

Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
@bazsi bazsi force-pushed the filterx-inplace-add-for-improved-performance branch from 0af5515 to 1c2af1c Compare February 10, 2026 07:47
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.

2 participants