During D7 -> D7 user migrations, the password of the user being created is run through the drupal password hashing function user_hash_password unnecessarily. The result of that function is saved to the user table, then directly overwritten by the DrupalUser7Migration->complete() function.
On an import of 1000 users, here's the xhprof results for this function:
user_hash_password
Calls:1,000
INCL. WALL TIME (MICROSEC) 4,240,400
INCL. CPU (MICROSECS) 4,341,848
According to https://api.drupal.org/api/drupal/modules%21user%21user.module/function/... you can skip this step by not passing in a value for 'pass'. I'd recommend since the value is being overwritten anyways, that the DrupalUser7Migration rename the pass field during prepareRow(), to prevent hashing, and then restore the pass field during complete().
In tests, this shaved 4 seconds per 1000 users off of migration time. Considering I'm doing a migration of 4M users..... that's a pretty solid savings.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | migrate_d2d-skip_password_hashing.patch | 1.42 KB | netw3rker |
Comments
Comment #2
netw3rker commentedComment #3
netw3rker commentedupdated patch to have proper file paths.
Comment #4
netw3rker commentedWhoops.. that patch not only skips password hashing, but also deleted the password entirely. Here's an updated patch that preserves the password.
Comment #5
Chris CharltonI'm surprised D7-to-D7 migration had this flaw. Glad I checked here.