aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/maps.erl
AgeCommit message (Collapse)Author
2018-07-25Merge pull request #1886 from michalmuskala/mm/maps-refactorJohn Högberg
Refactor maps.erl
2018-07-23Refine types of functions in maps moduleMichał Muskała
This only touches functions that are not further manually enhanced in erl_bif_types. The hope is that this will allow dialyzer to discover more issues in code using maps.
2018-07-19Optimise functions in the maps moduleMichał Muskała
Using direct pattern matching on the map is more effient than pattern matching on the result of maps:find/2, because it avoids allocating the intermediate tuple.
2018-07-17maps:new/0 is no longer a BIFMichał Muskała
Implementing it in Erlang allows taking advantage of the literal pool optimisation, this means the function implemented in Erlang does no allocations, while the BIF had to allocate new map each time it was called. Benchmarks show the function is also slightly faster now.
2018-06-18Update copyright yearHenrik Nord
2018-06-05stdlib: Fix error reason for maps:with/withoutLukas Larsson
2017-11-20erts: Implement batching maps:iteratorLukas Larsson
This iterator implementation fetches multiple elements to iterate over in one call to erts_internal:maps_next instead of one at a time. This means that the memory usage will go up for the iterator as we are buffering elements, but the usage is still bounded. In this implementation the max memory usage is 1000 words. Using this approach makes the iterator as fast as using maps:to_list, so maps:iterator/2 has been removed.
2017-10-13erts: Implement maps path iteratorLukas Larsson
2017-10-13erts: Implement map iterator using a stackLukas Larsson
This version does not work great as the subtrees created are not proper hash maps. Also it is not all that performant as the extra allocations to keep the stack there is expensive.
2017-10-13stdlib: Introduce maps iterator APILukas Larsson
2016-04-28stdlib: Add shadow comments for BIFs in mapsBjörn-Egil Dahlberg
Type information is stored in erl_bif_types for certain BIFs. This fact must be stated in the type specification for the stubs that are superceded by erl_bif_types. * Shadowed by erl_bif_types: maps:from_list/1 * Shadowed by erl_bif_types: maps:get/2 * Shadowed by erl_bif_types: maps:is_key/2 * Shadowed by erl_bif_types: maps:merge/2 * Shadowed by erl_bif_types: maps:put/3 * Shadowed by erl_bif_types: maps:to_list/1 * Shadowed by erl_bif_types: maps:update/3
2016-04-27stdlib: Add maps:update_with/3,4Björn-Egil Dahlberg
Maps equivalent to dict:update/3,4
2016-04-22erts: Add BIF maps:take/2Björn-Egil Dahlberg
2016-03-15update copyright-yearHenrik Nord
2016-02-09Improved maps:with/2 and maps:without/2 algorithmBen Wilson
The current implementation is roughly O(N*M) where N is the number of items to be removed, and M is the number of items in the map. This does not include the cost of `maps:from_list` or `maps:to_list`. This leads to pretty horrifying execution times on large maps regardless of how many or few keys are to be removed. The new implementation is O(N) where N is the number of items to be removed. For each N there's the cost of removing a key from a map, and but in practice that turns out to be a vast improvement for all map sizes I tested The new maps:take/2 implementation similarly builds a list of keys and values by iterating only the list of desired keys, and then hands it off to maps:from_list. This turned out to be faster than N maps:put calls.
2015-06-18Change license text to APLv2Bruce Yinhe
2015-05-19stdlib: Use lc to implement maps:map/2Björn-Egil Dahlberg
2015-05-18stdlib: Add maps:filter/2Björn-Egil Dahlberg
2015-04-13stdlib: Correct maps module exceptions upon errorsBjörn-Egil Dahlberg
Bad input to maps module function will now yield exceptions: * {badmap,NotMap} or, * badarg
2014-08-26Merge branch 'kittee/maps_only' into maintMarcus Arendt
* kittee/maps_only: maps:only/2 -> maps:with/2 add maps:only/2
2014-07-10maps:only/2 -> maps:with/2Igor Savchuk
2014-07-07add maps:only/2Igor Savchuk
2014-07-01documentation: maps:values() returns list of keyslharc
probably a copy&paste error from maps:keys()
2014-04-12Add default value for maps:getSergey Abramyan
2014-03-28Take out no_native compiler attributeKostis Sagonas
2014-03-06stdlib: Fix maps:from_list/1 spec.Björn-Egil Dahlberg
2014-01-31Allow making the system with --enable-native-libsKostis Sagonas
The HiPE compiler crashes when trying to compile these files because it does not currently support maps. So, add a -compile(no_native) attribute to these files to allow the system to be made even when configured with --enable-native-libs. This is a temporary fix and will be removed when the HiPE compiler gets proper support for maps.
2014-01-29stdlib: Make maps:fold/3 order-independentBjörn-Egil Dahlberg
This means replacing maps:foldl/3 and maps:foldr/3 with maps:fold/3.
2014-01-28stdlib: Strengthen Map module with guardsBjörn-Egil Dahlberg
This commit requires Map enabled bootstrap compiler.
2014-01-28stdlib: Remove bogus map() typeBjörn-Egil Dahlberg
2014-01-28erts,stdlib: Change map module name to mapsBjörn-Egil Dahlberg
Name conforms to EEP.