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

Fix newsletter queue subscribers adding performance #4088

Merged
merged 1 commit into from
Dec 7, 2016
Merged

Fix newsletter queue subscribers adding performance #4088

merged 1 commit into from
Dec 7, 2016

Conversation

mcjwsk
Copy link
Contributor

@mcjwsk mcjwsk commented Apr 11, 2016

I made some interesting benchmark for it :)

Benchmark:

<?php

$max = 100000;
$ids = range(1, $max);
$usedIds = range(1, $max, 10);
$result = [];

// Current Magento2 method
$start = microtime(true);
foreach ($ids as $id) {
    if (in_array($id, $usedIds)) {
        continue;
    }
    $result[] = $id;
}
$end = microtime(true);
var_dump($end-$start);
var_dump(count($result));

// Reset
$result = [];

// array_diff_key() method
$start = microtime(true);
$ids = array_flip($ids);
$usedIds = array_flip($usedIds);
$result = array_diff_key($ids, $usedIds);
$end = microtime(true);
var_dump($end-$start);
var_dump(count($result));

Output:

$ php benchmark.php
double(15.839307069778)
int(90000)
double(0.034869909286499)
int(90000)

@piotrekkaminski
Copy link
Contributor

Internal issue MAGETWO-53550

@piotrekkaminski piotrekkaminski self-assigned this May 27, 2016
@hshar7
Copy link
Contributor

hshar7 commented Jul 22, 2016

Please fix failing integration test that this is causing:
Magento\Newsletter\Model\QueueTest::testSendPerSubscriber
Magento\Newsletter\Model\QueueTest::testSendPerSubscriberProblem
Magento\Newsletter\Model\ResourceModel\Problem\CollectionTest::testAddCustomersData

@vkorotun vkorotun added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development and removed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development labels Aug 4, 2016
@vkorotun vkorotun added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development and removed linked labels Aug 22, 2016
@mmansoor-magento mmansoor-magento merged commit 01d907a into magento:develop Dec 7, 2016
mmansoor-magento pushed a commit that referenced this pull request Dec 7, 2016
[South] Bugs:
- MAGETWO-56072 [Performance] Image resize mechanism does not generate images of all necessary sizes
- MAGETWO-59904 [PR][Github] Update AccountLock.php #6952
- MAGETWO-53550 [Github][PR] Fix newsletter queue subscribers adding performance #4088
- MAGETWO-60047 [Porting] Error on adding address during checkout if add custom customer address attribute of file type - 2.2
- MAGETWO-56396 "Go Today" button in filter type date doesn`t apply value
- MAGETWO-59365 Countries list is not loaded if change customer website after country was selected
- MAGETWO-59924 File attribute doesn't have placeholder in admin
@mcjwsk mcjwsk deleted the patch-1 branch December 7, 2016 19:07
@Ctucker9233
Copy link

Still not included in 2.1.10

magento-engcom-team pushed a commit that referenced this pull request Apr 22, 2019
[trigger] MAGETWO-99210: Magento\Install\Test\TestCase\InstallTest is failing on php 7.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Customer improvement Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Progress: accept Progress: needs update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants