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

Less stringprepping in roster hooks #2997

Merged
merged 7 commits into from
Jan 12, 2021

Conversation

NelsonVides
Copy link
Collaborator

This PR, like several others I've done in the past, aim to reduce the redundancy of stringprepping again and again different blocks of a jid all over the MIM code, and instead taking advantage of the jid record. More type-safety, less code, and a tiny slightly bit more performance.

@NelsonVides NelsonVides force-pushed the less_stringprepping_in_roster_hooks branch 2 times, most recently from df64e46 to b9307f5 Compare January 7, 2021 11:14
@mongoose-im
Copy link
Collaborator

mongoose-im commented Jan 7, 2021

8980.1 / Erlang 23.0.3 / small_tests / fe00bff
Reports root / small


8980.2 / Erlang 23.0.3 / internal_mnesia / fe00bff
Reports root/ big
OK: 1495 / Failed: 0 / User-skipped: 168 / Auto-skipped: 0


8980.4 / Erlang 23.0.3 / mysql_redis / fe00bff
Reports root/ big
OK: 2766 / Failed: 0 / User-skipped: 233 / Auto-skipped: 0


8980.3 / Erlang 23.0.3 / odbc_mssql_mnesia / fe00bff
Reports root/ big
OK: 2771 / Failed: 0 / User-skipped: 228 / Auto-skipped: 0


8980.7 / Erlang 23.0.3 / elasticsearch_and_cassandra_mnesia / fe00bff
Reports root/ big
OK: 330 / Failed: 0 / User-skipped: 38 / Auto-skipped: 0


8980.5 / Erlang 23.0.3 / riak_mnesia / fe00bff
Reports root/ big
OK: 1629 / Failed: 0 / User-skipped: 180 / Auto-skipped: 0


8980.6 / Erlang 23.0.3 / ldap_mnesia / fe00bff
Reports root/ big
OK: 1405 / Failed: 0 / User-skipped: 258 / Auto-skipped: 0


8980.9 / Erlang 22.3 / pgsql_mnesia / fe00bff
Reports root/ big / small
OK: 2784 / Failed: 0 / User-skipped: 215 / Auto-skipped: 0

@mongoose-im
Copy link
Collaborator

mongoose-im commented Jan 7, 2021

8982.1 / Erlang 23.0.3 / small_tests / dfab0a3
Reports root / small


8982.2 / Erlang 23.0.3 / internal_mnesia / dfab0a3
Reports root/ big
OK: 1495 / Failed: 0 / User-skipped: 168 / Auto-skipped: 0


8982.3 / Erlang 23.0.3 / odbc_mssql_mnesia / dfab0a3
Reports root/ big
OK: 2771 / Failed: 0 / User-skipped: 228 / Auto-skipped: 0


8982.4 / Erlang 23.0.3 / mysql_redis / dfab0a3
Reports root/ big
OK: 2766 / Failed: 0 / User-skipped: 233 / Auto-skipped: 0


8982.7 / Erlang 23.0.3 / elasticsearch_and_cassandra_mnesia / dfab0a3
Reports root/ big
OK: 330 / Failed: 0 / User-skipped: 38 / Auto-skipped: 0


8982.6 / Erlang 23.0.3 / ldap_mnesia / dfab0a3
Reports root/ big
OK: 1405 / Failed: 0 / User-skipped: 258 / Auto-skipped: 0


8982.5 / Erlang 23.0.3 / riak_mnesia / dfab0a3
Reports root/ big
OK: 1629 / Failed: 0 / User-skipped: 180 / Auto-skipped: 0


8982.9 / Erlang 22.3 / pgsql_mnesia / dfab0a3
Reports root/ big / small
OK: 2784 / Failed: 0 / User-skipped: 215 / Auto-skipped: 0

@codecov
Copy link

codecov bot commented Jan 7, 2021

Codecov Report

Merging #2997 (1a25d28) into master (d5c1586) will decrease coverage by 0.03%.
The diff coverage is 67.85%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2997      +/-   ##
==========================================
- Coverage   79.12%   79.09%   -0.04%     
==========================================
  Files         377      377              
  Lines       32840    32835       -5     
==========================================
- Hits        25986    25971      -15     
- Misses       6854     6864      +10     
Impacted Files Coverage Δ
src/mod_last.erl 88.88% <ø> (ø)
src/mod_shared_roster_ldap.erl 0.00% <0.00%> (ø)
src/mod_roster.erl 77.38% <61.53%> (-2.10%) ⬇️
src/admin_extra/service_admin_extra_roster.erl 87.16% <100.00%> (ø)
src/ejabberd_c2s.erl 89.33% <100.00%> (-0.01%) ⬇️
src/ejabberd_sm.erl 75.91% <100.00%> (-0.08%) ⬇️
src/mam/mod_mam_utils.erl 88.99% <100.00%> (-0.65%) ⬇️
src/metrics/mongoose_metrics_hooks.erl 97.05% <100.00%> (ø)
src/mod_commands.erl 94.44% <100.00%> (-0.08%) ⬇️
src/mod_disco.erl 65.38% <100.00%> (ø)
... and 18 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 d5c1586...1a25d28. Read the comment docs.

Copy link
Contributor

@janciesla8818 janciesla8818 left a comment

Choose a reason for hiding this comment

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

Great stuff! Thanks for keeping this coming and improving the performance step by step.


% Deprecated Hooks
-export([
% get_user_roster/2,
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it means that get_user_roster/2 that is accepting tuple of binaries is to be deprecated. It's clear after reading the code, but just looking at the exports and comparing with line 59 is slightly confusing. Maybe we could extend the comment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Comment extended 😄

Mark old hooks as deprecated, some better code patterns using
jid:to_bare, no export of a function that is not needed.
@mongoose-im
Copy link
Collaborator

mongoose-im commented Jan 11, 2021

9009.1 / Erlang 23.0.3 / small_tests / ad63568
Reports root / small


9009.2 / Erlang 23.0.3 / internal_mnesia / ad63568
Reports root/ big
OK: 1503 / Failed: 0 / User-skipped: 160 / Auto-skipped: 0


9009.3 / Erlang 23.0.3 / odbc_mssql_mnesia / ad63568
Reports root/ big
OK: 2771 / Failed: 0 / User-skipped: 228 / Auto-skipped: 0


9009.4 / Erlang 23.0.3 / mysql_redis / ad63568
Reports root/ big
OK: 2766 / Failed: 0 / User-skipped: 233 / Auto-skipped: 0


9009.5 / Erlang 23.0.3 / riak_mnesia / ad63568
Reports root/ big
OK: 1629 / Failed: 0 / User-skipped: 180 / Auto-skipped: 0


9009.6 / Erlang 23.0.3 / ldap_mnesia / ad63568
Reports root/ big
OK: 1405 / Failed: 0 / User-skipped: 258 / Auto-skipped: 0


9009.7 / Erlang 23.0.3 / elasticsearch_and_cassandra_mnesia / ad63568
Reports root/ big
OK: 330 / Failed: 0 / User-skipped: 38 / Auto-skipped: 0


9009.9 / Erlang 22.3 / pgsql_mnesia / ad63568
Reports root/ big / small
OK: 2784 / Failed: 0 / User-skipped: 215 / Auto-skipped: 0

@janciesla8818 janciesla8818 merged commit 20d587c into master Jan 12, 2021
@janciesla8818 janciesla8818 deleted the less_stringprepping_in_roster_hooks branch January 12, 2021 09:40
@leszke leszke added this to the 4.1.0 milestone Feb 3, 2021
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