-
-
Notifications
You must be signed in to change notification settings - Fork 161
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
Fill and humanize labels at definition time #494
Comments
Good ideas. I will get this done. |
I'm happy to send a PR too if you point me in the right direction |
#240 can be done as part of this, too. In SS constructor, we will inflect any missing labels unless |
Also adding #494 to this issue: Before humanizing, check whether SimpleSchema.defaultLabel = function (key) {
return i18n.t(key);
}; |
Hey @marcodejongh - I'm not sure exactly what I was running previously, but just trying the following code: const s = SimpleSchema({a: {type: String}, b: {type: String}, c: {type: String}});
var start = new Date();
_.times(10000, () => {
check({a: 'a', b: 'b', c: 'c'}, s);
});
new Date() - start; Was previously taking ~1100ms in the browser console, now it takes ~550ms. So that's a nice 2x speedup. In the server console it was taking ~4700ms and now it's taking ~1200ms, so that's even better! |
Thanks for your patience. SimpleSchema 2.0.0-rc.1 is now released and should fix this bug. There are a number of breaking changes when updating to 2.0, so be sure to check out the change log. If you use aldeed:collection2, you will need to use 2.10.0 or higher of that package in order to use SimpleSchema 2.0. If you use autoform, it is not yet updated to work with SimpleSchema 2.0, but hopefully soon. SimpleSchema is now an isomorphic NPM package, so you can check out the updated readme and file issues over at the other repo. The Meteor wrapper package will exist for now but eventually I will probably deprecate support for it. This is still a beta/RC and I do expect people will find issues, so use with caution. Production use is not yet recommended. That said, there are more and better unit tests than ever before, and the codebase should be much easier for others to read through and debug quickly. |
Ok, moving over from meteor/guide#53 (comment)
This schema:
Takes ~2.5s to validate 10k documents of the form
{a: 'a', b: 'b', c: 'c'}
.If I add a label to each field definition (to bypass the call to
S.humanize()
), that time drops to ~325ms.@aldeed - would you be interested in a PR that helps with this problem? Some ideas of how to solve it:
humanize
on the label until later when we actually need itThe text was updated successfully, but these errors were encountered: