Skip to content

Conversation

@arjunnair1997
Copy link
Contributor

@arjunnair1997 arjunnair1997 commented Aug 5, 2025

Adds a DeleteRangeReuse function which takes an input parameter with a List[T] to avoid allocating the List across calls to delete range.

Adds a DeleteRangeUnsafe function which takes an input parameter with a List[T]
to avoid allocating the List across calls to delete range.
@arjunnair1997 arjunnair1997 force-pushed the arjun/opt_alloc_delete_range branch from 6a1d1be to fa8aff6 Compare August 5, 2025 19:05
@tidwall
Copy link
Owner

tidwall commented Aug 5, 2025

Makes sense to me.
I'm fine with this code overall, but I would prefer not to use the 'Unsafe' suffix. Since it doesn't use the unsafe package and appears to be pretty safe on the surface. Perhaps call it DeleteRangeReuse or something similar. The comment talking about not sharing lists between goroutines should suffice.

@arjunnair1997
Copy link
Contributor Author

@tidwall updated

@tidwall tidwall merged commit 490165c into tidwall:master Aug 5, 2025
3 checks passed
@tidwall
Copy link
Owner

tidwall commented Aug 5, 2025

LGTM!

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