gdbate/vuex-orm-benchmark

Import code is flawed.

somazx opened this issue · 1 comments

You don't need the loops while importing. This is why the benchmark for Vuex-ORM is so much slower here. Most of the benchmark time is spent in the loop.

Instead just do:

Character.create({data: characters})
Episode.create({data: episodes})
Location.create({data: locations})

This will import the data in one giant batch for each entity.

Using your original code the import took 518ms. Once rewritten as above, it took 45ms.

I saw your article and second @somazx. I ran into this problem with my vuex-orm-json-api library and solved it by wrapping all inserts in a Promise.all: scalient/vuex-orm-json-api@db520b9.