Here's a sample file which reproduces the issue on my machine; I'm running faker 2.0.0
var time = Date.now();
var faker = require('faker');
console.log("Loading faker took " + (Date.now() - time) + "ms");
// For comparison
time = Date.now();
var uuid = require('node-uuid');
console.log("Loading uuid took " + (Date.now() - time) + "ms");
What is going on that takes Faker so long to load? When your tests take less than 1ms each to execute, it's odd to see a 60ms slowdown.
Could there be a workaround/ a way to load less data on system start?
Related Issue #125
@kevinburke - The work-around would be to comment out the locale requires you aren't using in this file: https://github.com/Marak/faker.js/blob/master/lib/locales.js
Closing for now. If anyone has issues with the work-around please let me know.
In master, we now have the ability to individually require faker locales without having to load all of them.
Should should help a bit.
var faker = require('faker/locale/en');
Most helpful comment
In
master, we now have the ability to individually require faker locales without having to load all of them.Should should help a bit.