Hi José,
Separate from any performance concerns, I’d say it’s a minor change that
vastly improves clarity as it relates to the intention of the code. When
reviewing code I’d certainly have to read more carefully seeing something
equivalent to `{current_value, current_value}` than I would `:keep`
rich
On Mar 19, 2021 at 7:30:41 AM, José Valim <[email protected]> wrote:
> Hi Eksperimental,
>
> Thanks for the proposal!
>
> Can you please provide an example of where you think this would be
> optimized? I am certain for keyword it won't make a large difference
> because the cost is in traversing the keyword. And for maps, usually there
> is no update if you are trying to put the same value back, so I would say
> those concerns are already handled within the runtime.
>
> On Fri, Mar 19, 2021 at 12:06 PM eksperimental <
> [email protected]> wrote:
>
>> I have noticed that there are times that based on the get value, there
>> is no need to update the data, and we have just to pass the same data
>> back.
>> So in addition to `:pop` I propose to add `:keep` or `:skip`.
>>
>> This will optimize things quiet a not only in {Map,
>> Keyword}.get_and_update/3 but aslo in Access.get_and_update/3 since we
>> won't have to dispatch and return directly.
>>
>> Please let me know what you think,
>> Thank you.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "elixir-lang-core" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/elixir-lang-core/605485c2.1c69fb81.df633.535dSMTPIN_ADDED_MISSING%40gmr-mx.google.com
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4JqLTQ%3DNm%3Db2rvdrY93FT%3DqOTNCcGi%3DpksK%2BgsP5EPe9w%40mail.gmail.com
> <https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4JqLTQ%3DNm%3Db2rvdrY93FT%3DqOTNCcGi%3DpksK%2BgsP5EPe9w%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
--
You received this message because you are subscribed to the Google Groups
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elixir-lang-core/CAFKEhq6QMJKZjSu%2BF7cp7%2BQs9yem_NYHwFFq8cp1kqkisMbVjw%40mail.gmail.com.