Skip to content

Add ability to uglify generated code #36

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

Merged
merged 1 commit into from
May 22, 2017
Merged

Add ability to uglify generated code #36

merged 1 commit into from
May 22, 2017

Conversation

SimenB
Copy link
Member

@SimenB SimenB commented May 20, 2017

@mcollina Something like this you had in mind?

@@ -2,6 +2,7 @@

const fastSafeStringify = require('fast-safe-stringify')

var uglify = null
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems inconsistent between let and var in the code base. Which do you want?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var is better since is a little faster than let, thanks! :)

bench.js Outdated
const stringifyString = require('.')({ type: 'string' })
const stringify = require('.')(schema, { uglify: true })
const stringifyArray = require('.')(arraySchema, { uglify: true })
const stringifyString = require('.')({ type: 'string', uglify: true })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you include benchmarks for both uglified and non-uglified versions?

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a nit.

Can you also update the benchmarks?

@mcollina
Copy link
Member

This is also conflicting for the other two PRs, can you rebase as well?

@mcollina
Copy link
Member

@delvedor I think we can bump v1.0.0 when this lands, it has been pretty stable API-wise for the last releases.

@delvedor
Copy link
Member

@mcollina I agree, but before I think we should close/improve #22, then we are ready!

Copy link
Member

@delvedor delvedor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SimenB
Copy link
Member Author

SimenB commented May 21, 2017

Rebased and separate benchmark added plus updated readme.

JSON.stringify obj x 1,774,593 ops/sec ±1.07% (90 runs sampled)
fast-json-stringify obj x 4,976,369 ops/sec ±1.00% (89 runs sampled)
JSON.stringify array x 3,288 ops/sec ±5.18% (82 runs sampled)
fast-json-stringify array x 1,813 ops/sec ±10.21% (71 runs sampled)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is worse, but that's #15, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we must definitely fix that issue :S

@@ -29,7 +29,8 @@
"long": "^3.2.0",
"pre-commit": "^1.1.3",
"standard": "^10.0.0",
"tap": "^10.3.0"
"tap": "^10.3.0",
"uglify-es": "^3.0.9"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need the es variant to support const in the code, btw

@mcollina mcollina merged commit 6c90070 into fastify:master May 22, 2017
@mcollina
Copy link
Member

@SimenB would you like to help maintaining this library and join our team?

@SimenB SimenB deleted the uglify branch May 22, 2017 10:44
@SimenB
Copy link
Member Author

SimenB commented May 29, 2017

@mcollina I'd love to join up! 🙂

@mcollina
Copy link
Member

I've sent you an invitation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants