Thread overview
[Issue 13136] Optimize double lookup from if (v in assocArray) { return assocArray[v]; }
Jul 16, 2014
Orvid King
May 14, 2019
Marco de Wild
July 15, 2014
https://issues.dlang.org/show_bug.cgi?id=13136

bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs@eml.cc

--- Comment #1 from bearophile_hugs@eml.cc ---
(In reply to Mark Isaacson from comment #0)

> He suggested that I post an enhancement request to make these compile to equivalent code.

Note that LDC already performs this optimization.

--
July 16, 2014
https://issues.dlang.org/show_bug.cgi?id=13136

Orvid King <blah38621@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |blah38621@gmail.com

--
May 14, 2019
https://issues.dlang.org/show_bug.cgi?id=13136

Marco de Wild <nanayamae@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |nanayamae@gmail.com
         Resolution|---                         |FIXED

--- Comment #2 from Marco de Wild <nanayamae@gmail.com> ---
I found this issue when browsing and I propose closing it as fixed.

https://dlang.org/spec/hash-map.html#inserting_if_not_present

In the meanwhile single-lookup assoc. array operations were added.

--