-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Labels
lang:javascriptIssues affecting JSIssues affecting JSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.type:perfIssue with performance of PrettierIssue with performance of Prettier
Description
When the input string contains many (about 25) nested function calls in JavaScript, prettier.format() takes about 2.5 minutes to return. This seems to occur when coreFormat() converts the AST to a document (in printAstToDoc()).
Environment:
- macOS High Sierra 10.13.4
- Node 8.9.4 and 9.11.1
- MacBook Pro 2017, 2.7GHz i7, 16GB 2133MHz LPDDR3
Prettier 1.13.5
Playground link
Input:
_c("div", [
_c("div", [
_c("div", [
_c("div", [
_c("div", [
_c("div", [
_c("div", [
_c("div", [
_c("div", [
_c("div", [
_c("div", [
_c("div", [
_c("div", [
_c("div", [
_c("div", [
_c("div", [
_c("div", [
_c("div", [
_c("div", [
_c("div", [
_c("div", [
_c("div", [
_c("div", [_c("div", [_c("div")])])
])
])
])
])
])
])
])
])
])
])
])
])
])
])
])
])
])
])
])
])
])
])Output:
(same as input after 159 seconds)
Expected behavior:
prettier.format(input) returns within a few seconds (much sooner than 159 seconds)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
lang:javascriptIssues affecting JSIssues affecting JSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.type:perfIssue with performance of PrettierIssue with performance of Prettier