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

require('faker') is very slow, takes about 60ms #167

Closed
kevinburke opened this Issue Jan 29, 2015 · 5 comments

Comments

Projects
None yet
3 participants
@kevinburke

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.

@kevinburke

This comment has been minimized.

Show comment
Hide comment
@kevinburke

kevinburke Jan 29, 2015

Could there be a workaround/ a way to load less data on system start?

Could there be a workaround/ a way to load less data on system start?

@Marak

This comment has been minimized.

Show comment
Hide comment
@Marak

Marak Jan 29, 2015

Owner

Related Issue #125

Owner

Marak commented Jan 29, 2015

Related Issue #125

@Marak

This comment has been minimized.

Show comment
Hide comment
@Marak

Marak Jul 5, 2015

Owner

@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

Owner

Marak commented Jul 5, 2015

@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

@Marak

This comment has been minimized.

Show comment
Hide comment
@Marak

Marak Jul 5, 2015

Owner

Closing for now. If anyone has issues with the work-around please let me know.

Owner

Marak commented Jul 5, 2015

Closing for now. If anyone has issues with the work-around please let me know.

@Marak Marak closed this Jul 5, 2015

@Marak Marak reopened this Jul 7, 2015

Marak added a commit that referenced this issue Jul 7, 2015

[refactor] [dist] Allow for node to require individual locales ( to a…
…void the default behavior of requiring all locale data. #125 #167
@Marak

This comment has been minimized.

Show comment
Hide comment
@Marak

Marak Jul 7, 2015

Owner

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');
Owner

Marak commented Jul 7, 2015

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');

@Marak Marak closed this Jul 16, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment