Skip to content
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

Pathological performance on long call chain with list literal arguments #496

Closed
munificent opened this issue Mar 10, 2016 · 1 comment
Closed

Comments

@munificent
Copy link
Member

This (very large) statement hits the max number of tries in line breaking and fails to format ideally:

    selection.callMethod('enter').callMethod('append', ["svg"]).callMethod(
            'attr', ["class", "box"]).callMethod('attr', ["width", width])
        .callMethod('attr', ["height", height]).callMethod('append', ["g"])
        .callMethod(
            'attr', ["transform", 'translate(${margin[3]},${margin[0]})'])
        .callMethod('append', ["text"]).callMethod('attr', ["class", "label"])
        .callMethod('text', [(_, i, __) => groups[i]]);

The problem is that those list literals break each .callMethod() into a separate rule, so we can't easily split this before every . as one rule.

@munificent
Copy link
Member Author

The forthcoming tall style doesn't have any performance problems on this code and produces:

    selection
        .callMethod('enter')
        .callMethod('append', ["svg"])
        .callMethod('attr', ["class", "box"])
        .callMethod('attr', ["width", width])
        .callMethod('attr', ["height", height])
        .callMethod('append', ["g"])
        .callMethod('attr', [
          "transform",
          'translate(${margin[3]},${margin[0]})',
        ])
        .callMethod('append', ["text"])
        .callMethod('attr', ["class", "label"])
        .callMethod('text', [(_, i, __) => groups[i]]);

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

No branches or pull requests

1 participant