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

console: optimize the log function for single param #140

Merged
merged 2 commits into from Jun 8, 2018

Conversation

Projects
None yet
3 participants
@yorkie
Member

yorkie commented Jun 8, 2018

BTW, added the benchmark for console.log.

> console/common.js n=128: 22,295.029427697045   #before
> console/common.js n=128: 38,630.9784834504     #after

The performance under this case is optimized 57% up :)

@yorkie yorkie requested review from algebrait, lolBig and legendecas Jun 8, 2018

@yorkie yorkie changed the title from console: optimize the performance for log when just 1 param to console: optimize the log function for single argument Jun 8, 2018

@yorkie yorkie changed the title from console: optimize the log function for single argument to console: optimize the log function for single param Jun 8, 2018

@algebrait

This comment has been minimized.

Contributor

algebrait commented Jun 8, 2018

LGTM

@yorkie yorkie merged commit 08c291f into master Jun 8, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@yorkie yorkie deleted the optimize/console branch Jun 8, 2018

@legendecas

This comment has been minimized.

Member

legendecas commented Jun 8, 2018

There is no stack trace if an error instance is coerced to string, if it's more friendly that stack trace could be printed if an error is the only argument of invocations of console.log/info/... etc.?

@yorkie

This comment has been minimized.

Member

yorkie commented Jun 8, 2018

Yea, you are right @legendecas, I'm glad that we could handle the single arguments as a special case in util.format(), could you please create a PR for this?

@yorkie

This comment has been minimized.

Member

yorkie commented Jun 8, 2018

After optimizing the format function with single param, we could remove the checks here :)

@yorkie yorkie referenced this pull request Aug 8, 2018

Closed

console: print object #269

1 of 3 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment