Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pattern match the map key for more efficiency #3635

Merged
merged 1 commit into from
Apr 22, 2022
Merged

Pattern match the map key for more efficiency #3635

merged 1 commit into from
Apr 22, 2022

Conversation

NelsonVides
Copy link
Collaborator

Doing maps:find creates the ok-tuple, which means garbage, and also then
needs to match on it. It it more efficient to pattern-match on the map key.

Doing maps:find creates the ok-tuple, which means garbage, and also then
needs to match on it. It it more efficient to pattern-match on the map key.
@codecov
Copy link

codecov bot commented Apr 22, 2022

Codecov Report

Merging #3635 (9527a06) into master (6d1c24b) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #3635      +/-   ##
==========================================
- Coverage   81.03%   81.03%   -0.01%     
==========================================
  Files         427      427              
  Lines       31962    31962              
==========================================
- Hits        25901    25899       -2     
- Misses       6061     6063       +2     
Impacted Files Coverage Δ
src/mongoose_acc.erl 92.64% <100.00%> (ø)
...system_metrics/service_mongoose_system_metrics.erl 78.43% <0.00%> (-7.85%) ⬇️
src/elasticsearch/mongoose_elasticsearch.erl 76.92% <0.00%> (-7.70%) ⬇️
src/mongoose_tcp_listener.erl 78.04% <0.00%> (-4.88%) ⬇️
src/mam/mod_mam_elasticsearch_arch.erl 85.08% <0.00%> (-1.76%) ⬇️
src/pubsub/mod_pubsub_db_mnesia.erl 92.43% <0.00%> (-0.43%) ⬇️
src/mod_muc_log.erl 63.21% <0.00%> (ø)
src/pubsub/mod_pubsub.erl 72.94% <0.00%> (+0.06%) ⬆️
src/mod_muc_room.erl 76.70% <0.00%> (+0.11%) ⬆️
src/inbox/mod_inbox_rdbms.erl 94.25% <0.00%> (+0.57%) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6d1c24b...9527a06. Read the comment docs.

@mongoose-im
Copy link
Collaborator

mongoose-im commented Apr 22, 2022

small_tests_24 / small_tests / 9527a06
Reports root / small


small_tests_23 / small_tests / 9527a06
Reports root / small


dynamic_domains_pgsql_mnesia_23 / pgsql_mnesia / 9527a06
Reports root/ big
OK: 2860 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 9527a06
Reports root/ big
OK: 2860 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


dynamic_domains_mysql_redis_24 / mysql_redis / 9527a06
Reports root/ big
OK: 2843 / Failed: 0 / User-skipped: 150 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_24 / odbc_mssql_mnesia / 9527a06
Reports root/ big
OK: 2860 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


ldap_mnesia_23 / ldap_mnesia / 9527a06
Reports root/ big
OK: 1506 / Failed: 0 / User-skipped: 401 / Auto-skipped: 0


ldap_mnesia_24 / ldap_mnesia / 9527a06
Reports root/ big
OK: 1506 / Failed: 0 / User-skipped: 401 / Auto-skipped: 0


internal_mnesia_24 / internal_mnesia / 9527a06
Reports root/ big
OK: 1547 / Failed: 0 / User-skipped: 360 / Auto-skipped: 0


pgsql_mnesia_23 / pgsql_mnesia / 9527a06
Reports root/ big
OK: 3234 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / 9527a06
Reports root/ big
OK: 3234 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


elasticsearch_and_cassandra_24 / elasticsearch_and_cassandra_mnesia / 9527a06
Reports root/ big
OK: 1854 / Failed: 0 / User-skipped: 368 / Auto-skipped: 0


mysql_redis_24 / mysql_redis / 9527a06
Reports root/ big
OK: 3229 / Failed: 0 / User-skipped: 147 / Auto-skipped: 0


mssql_mnesia_24 / odbc_mssql_mnesia / 9527a06
Reports root/ big
OK: 3234 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


riak_mnesia_24 / riak_mnesia / 9527a06
Reports root/ big
OK: 1697 / Failed: 0 / User-skipped: 367 / Auto-skipped: 0

@NelsonVides NelsonVides marked this pull request as ready for review April 22, 2022 13:01
Copy link
Member

@chrzaszcz chrzaszcz left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@chrzaszcz chrzaszcz merged commit f5b511c into master Apr 22, 2022
@chrzaszcz chrzaszcz deleted the perf/macc branch April 22, 2022 13:06
@Premwoik Premwoik added this to the 5.1.0 milestone May 25, 2022
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.

4 participants