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

[IMP] mail_tracking: email score performance #299

Merged
merged 2 commits into from
Sep 6, 2018

Conversation

chienandalu
Copy link
Member

In instances with tons of trackings this method can resent performance. Hopefully this improves it.

cc @Tecnativa

data = self.read_group([('recipient_address', '=', email.lower())],
['recipient_address', 'state'], ['state'])
mapped_data = dict([(state['state'], state['state_count'])
for state in data])
Copy link
Member

Choose a reason for hiding this comment

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

Remove the surrounding [...] brackets.

With brackets:

  1. Produce a lazy generator.
  2. Exhaust the generator converting it into a list.
  3. Convert the list in a dict.

Without brackets:

  1. Produce a lazy generator.
  2. Exhaust the generator converting it into a dict.

You can save tons of loops! 😊


Note that another idiomatic way (equivalent to doing it without brackets) to do so is:

mapped_data = {state['state']: state['state_count'] for state in data}

Copy link
Member Author

Choose a reason for hiding this comment

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

Noted and fixed 😉

Full coverage as well.

@pedrobaeza pedrobaeza merged commit 361db61 into OCA:11.0 Sep 6, 2018
@pedrobaeza pedrobaeza added this to the 11.0 milestone Sep 6, 2018
@pedrobaeza pedrobaeza deleted the 11.0-imp-mail_tracking-performance branch September 6, 2018 09:24
JordiBForgeFlow pushed a commit to ForgeFlow/social that referenced this pull request Nov 2, 2018
ernestotejeda pushed a commit to Tecnativa/social that referenced this pull request Nov 5, 2018
ernestotejeda pushed a commit to Tecnativa/social that referenced this pull request Dec 18, 2018
alan196 pushed a commit to Jarsa/social that referenced this pull request Dec 22, 2018
ernestotejeda pushed a commit to Tecnativa/social that referenced this pull request Mar 7, 2019
Tardo pushed a commit to Tecnativa/social that referenced this pull request Nov 18, 2019
Tardo pushed a commit to Tecnativa/social that referenced this pull request Nov 18, 2019
Tardo pushed a commit to Tecnativa/social that referenced this pull request Dec 5, 2019
pedrobaeza pushed a commit to Tecnativa/social that referenced this pull request Jan 7, 2020
Tardo pushed a commit to Tecnativa/social that referenced this pull request Jan 27, 2020
Tardo pushed a commit to Tecnativa/social that referenced this pull request Feb 5, 2020
SimoneVagile pushed a commit to SimoneVagile/social that referenced this pull request Jun 22, 2021
marco1esparza pushed a commit to marco1esparza/social that referenced this pull request Dec 1, 2021
JasminSForgeFlow pushed a commit to ForgeFlow/social that referenced this pull request Mar 25, 2022
JasminSForgeFlow pushed a commit to ForgeFlow/social that referenced this pull request Apr 20, 2022
maq-adhoc pushed a commit to adhoc-dev/social that referenced this pull request Dec 15, 2022
hvgollar pushed a commit to dynapps/social that referenced this pull request Dec 19, 2022
alan196 pushed a commit to Jarsa/social that referenced this pull request Feb 20, 2023
maq-adhoc pushed a commit to adhoc-dev/social that referenced this pull request Mar 6, 2023
mathieudelva pushed a commit to mathieudelva/social that referenced this pull request May 23, 2023
payen000 pushed a commit to vauxoo-dev/social that referenced this pull request Sep 5, 2023
payen000 pushed a commit to vauxoo-dev/social that referenced this pull request Sep 25, 2023
nguyenminhchien pushed a commit to nguyenminhchien/social that referenced this pull request Oct 20, 2023
trisdoan pushed a commit to trisdoan/social that referenced this pull request Mar 15, 2024
chienandalu added a commit to Tecnativa/social that referenced this pull request May 14, 2024
chienandalu added a commit to Tecnativa/social that referenced this pull request May 30, 2024
trisdoan pushed a commit to trisdoan/social that referenced this pull request May 31, 2024
trisdoan pushed a commit to trisdoan/social that referenced this pull request Sep 23, 2024
trisdoan pushed a commit to trisdoan/social that referenced this pull request Sep 23, 2024
trisdoan pushed a commit to trisdoan/social that referenced this pull request Sep 27, 2024
trisdoan pushed a commit to trisdoan/social that referenced this pull request Oct 2, 2024
trisdoan pushed a commit to trisdoan/social that referenced this pull request Oct 3, 2024
trisdoan pushed a commit to trisdoan/social that referenced this pull request Oct 3, 2024
trisdoan pushed a commit to trisdoan/social that referenced this pull request Oct 3, 2024
trisdoan pushed a commit to trisdoan/social that referenced this pull request Oct 10, 2024
trisdoan pushed a commit to trisdoan/social that referenced this pull request Oct 23, 2024
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.

3 participants