Optimise import performance

- Fix `O(n)` complexity of `append_or_update_attribute`,
  we append objects to an array and re-save project
- Remove the usage of `keys.include?` as it performs `O(n)`
  search, instead use `.has_key?`
- Remove the usage of `.keys.first` as it performs a copy
  of all keys, instead use `.first.first`
104 jobs for optimise-import-performance in 74 minutes and 54 seconds (queued for 6 seconds)
Status Job ID Name Coverage
  Build
manual #258391204
gitlab-org allowed to fail manual
review-docs-deploy-manual
 
  Prepare
passed #258391211
gitlab-org
compile-assets pull-cache

00:06:07

passed #258391213
gitlab-org
retrieve-tests-metadata

00:01:00

passed #258391212
gitlab-org
setup-test-env

00:05:06

 
  Test
passed #258391326
docker gitlab-org
build-qa-image

00:06:08

passed #258391227
allowed to fail
code_quality

00:09:53

passed #258391329
gitlab-org
danger-review

00:01:57

passed #258391319
gitlab-org
db:check-schema-pg

00:02:13

passed #258391318
gitlab-org
db:migrate:reset-pg

00:03:21

passed #258391322
gitlab-org
db:rollback-pg

00:03:03

passed #258391230
allowed to fail
dependency_scanning

00:07:58

passed #258391214
gitlab-org
docs lint

00:03:05

passed #258391315
gitlab-org
downtime_check

00:02:08

passed #258391317
gitlab-org
ee_compat_check

00:03:45

passed #258391215
gitlab-org docker
gitlab:assets:compile pull-cache

00:19:24

passed #258391324
gitlab-org
gitlab:setup-pg

00:03:15

passed #258391331
gitlab-org
gitlab_git_test

00:00:49

passed #258391217
gitlab-org
jest

00:16:34

passed #258391216
gitlab-org
karma

00:10:06

54.02%
passed #258391335
gitlab-org
lint-ci-gitlab

00:00:52

passed #258391226
gitlab-org
memory-on-boot

00:04:35

passed #258391224
gitlab-org
memory-static

00:04:04

passed #258391321
gitlab-org
migration:path-pg

00:04:39

passed #258391333
gitlab-org
no_ee_check

00:01:08

passed #258391222
gitlab-org
qa-frontend-node:10

00:14:17

passed #258391221
gitlab-org
qa-frontend-node:8

00:16:25

passed #258391223
gitlab-org allowed to fail
qa-frontend-node:latest

00:14:25

passed #258391219
gitlab-org
qa:internal

00:02:57

passed #258391220
gitlab-org
qa:selectors

00:03:54

passed #258391328
allowed to fail manual
review-build-cng

00:34:44

passed #258391257
gitlab-org
rspec integration pg 1/6

00:20:08

passed #258391259
gitlab-org
rspec integration pg 2/6

00:18:41

passed #258391260
gitlab-org
rspec integration pg 3/6

00:16:32

passed #258391263
gitlab-org
rspec integration pg 4/6

00:18:18

passed #258391264
gitlab-org
rspec integration pg 5/6

00:18:44

passed #258391265
gitlab-org
rspec integration pg 6/6

00:16:39

passed #258391267
gitlab-org
rspec system pg 1/24

00:11:39

passed #258391282
gitlab-org
rspec system pg 10/24

00:11:50

passed #258391284
gitlab-org
rspec system pg 11/24

00:12:00

passed #258391285
gitlab-org
rspec system pg 12/24

00:14:42

passed #258391286
gitlab-org
rspec system pg 13/24

00:11:34

passed #258391287
gitlab-org
rspec system pg 14/24

00:13:54

passed #258391288
gitlab-org
rspec system pg 15/24

00:12:40

passed #258391289
gitlab-org
rspec system pg 16/24

00:12:14

passed #258391292
gitlab-org
rspec system pg 17/24

00:15:36

passed #258391295
gitlab-org
rspec system pg 18/24

00:12:05

passed #258391296
gitlab-org
rspec system pg 19/24

00:13:38

passed #258391269
gitlab-org
rspec system pg 2/24

00:13:29

passed #258391298
gitlab-org
rspec system pg 20/24

00:14:57

passed #258391299
gitlab-org
rspec system pg 21/24

00:13:45

passed #258391300
gitlab-org
rspec system pg 22/24

00:11:56

passed #258391301
gitlab-org
rspec system pg 23/24

00:13:09

passed #258391304
gitlab-org
rspec system pg 24/24

00:13:15

passed #258391271
gitlab-org
rspec system pg 3/24

00:14:09

passed #258391272
gitlab-org
rspec system pg 4/24

00:11:45

passed #258391273
gitlab-org
rspec system pg 5/24

00:13:50

passed #258391275
gitlab-org
rspec system pg 6/24

00:12:59

passed #258391278
gitlab-org
rspec system pg 7/24

00:11:58

passed #258391279
gitlab-org
rspec system pg 8/24

00:11:38

passed #258391280
gitlab-org
rspec system pg 9/24

00:11:33

passed #258391231
gitlab-org
rspec unit pg 1/20

00:14:05

passed #258391244
gitlab-org
rspec unit pg 10/20

00:18:42

passed #258391245
gitlab-org
rspec unit pg 11/20

00:15:15

passed #258391246
gitlab-org
rspec unit pg 12/20

00:21:16

passed #258391248
gitlab-org
rspec unit pg 13/20

00:16:53

passed #258391250
gitlab-org
rspec unit pg 14/20

00:18:25

passed #258391251
gitlab-org
rspec unit pg 15/20

00:15:54

passed #258391252
gitlab-org
rspec unit pg 16/20

00:14:57

passed #258391253
gitlab-org
rspec unit pg 17/20

00:16:55

passed #258391254
gitlab-org
rspec unit pg 18/20

00:19:39

passed #258391255
gitlab-org
rspec unit pg 19/20

00:17:38

passed #258391232
gitlab-org
rspec unit pg 2/20

00:15:18

passed #258391256
gitlab-org
rspec unit pg 20/20

00:18:57

passed #258391233
gitlab-org
rspec unit pg 3/20

00:12:55

passed #258391236
gitlab-org
rspec unit pg 4/20

00:17:14

passed #258391237
gitlab-org
rspec unit pg 5/20

00:13:30

passed #258391238
gitlab-org
rspec unit pg 6/20

00:12:45

passed #258391240
gitlab-org
rspec unit pg 7/20

00:12:49

passed #258391241
gitlab-org
rspec unit pg 8/20

00:13:36

passed #258391243
gitlab-org
rspec unit pg 9/20

00:14:53

passed #258391305
gitlab-org
rspec-fast-spec-helper

00:03:12

passed #258391229
allowed to fail
sast

00:07:56

passed #258391306
gitlab-org
static-analysis

00:12:19

 
  Review
manual #258391336
allowed to fail manual
package-and-qa
failed #258474505
gitlab-org allowed to fail
review-deploy

00:01:24

manual #258391342
gitlab-org allowed to fail manual
review-stop
failed #258391338
gitlab-org allowed to fail
review-deploy

00:16:54

 
  Qa
failed #258479630
docker gitlab-org allowed to fail
review-performance

00:02:23

manual #258391347
docker gitlab-org allowed to fail manual
review-qa-all 1/5
manual #258391350
docker gitlab-org allowed to fail manual
review-qa-all 2/5
manual #258391351
docker gitlab-org allowed to fail manual
review-qa-all 3/5
manual #258391352
docker gitlab-org allowed to fail manual
review-qa-all 4/5
manual #258391355
docker gitlab-org allowed to fail manual
review-qa-all 5/5
failed #258486528
docker gitlab-org allowed to fail
review-qa-smoke

00:05:38

failed #258477629
gitlab-org docker allowed to fail
review-performance

00:02:07

failed #258391357
docker gitlab-org allowed to fail
review-performance

00:02:33

failed #258481316
gitlab-org docker allowed to fail
review-qa-smoke

00:06:15

failed #258391345
docker gitlab-org allowed to fail
review-qa-smoke

00:06:12

 
  Post Test
passed #258391365
gitlab-org
coverage

00:03:46

96.4%
passed #258391368
gitlab-org allowed to fail
flaky-examples-check

00:02:04

passed #258391363
gitlab-org
jsdoc

00:01:23

passed #258391361
gitlab-org
lint:javascript:report

00:00:40

manual #258391366
gitlab-org allowed to fail manual
parallel-spec-reports
 
  Post Cleanup
manual #258391370
gitlab-org allowed to fail manual
review-docs-cleanup
 
Name Stage Failure
failed
review-qa-smoke Qa
  /home/qa/qa/scenario/template.rb:8:in `perform'
/home/qa/qa/scenario/bootable.rb:28:in `launch!'
bin/qa:7:in `<top (required)>'
Running after script...
$ date
Wed Jul 24 16:08:24 UTC 2019
Uploading artifacts...
./qa/gitlab-qa-run-*: found 2 matching files
ERROR: Job failed: exit code 1
failed
review-performance Qa
    at processImmediate [as _immediateCallback] (timers.js:722:5)
[2019-07-24 15:57:20] INFO: HTML stored in /sitespeed.io/sitespeed-results
[2019-07-24 15:57:20] INFO: Finished analysing https://gitlab-review-optimise-i-ydjvwf.ce.gitlab-review.app
Running after script...
$ mv sitespeed-results/data/performance.json performance.json
Uploading artifacts...
performance.json: found 1 matching files
Uploading artifacts to coordinator... ok
id=258479630 responseStatus=201 Created token=V7eEDmv7
ERROR: Job failed: exit code 1
failed
review-deploy Review

** Waiting for the Review App at https://gitlab-review-optimise-i-ydjvwf.ce.gitlab-review.app to be accessible... **
Running after script...
$ date
Wed Jul 24 15:50:06 UTC 2019
Uploading artifacts...
review_app_url.txt: found 1 matching files
Uploading artifacts to coordinator... ok
id=258474505 responseStatus=201 Created token=S83vVvUU
ERROR: Job failed: exit code 1