yapf: Pathologically slow example
The following takes 25 seconds to reformat on my machine. In comparison, many significantly larger files run in under a second:
specialElements = frozenset((
(namespaces['html'], 'address'),
(namespaces['html'], 'applet'),
(namespaces['html'], 'area'),
(namespaces['html'], 'article'),
(namespaces['html'], 'aside'),
(namespaces['html'], 'base'),
(namespaces['html'], 'basefont'),
(namespaces['html'], 'bgsound'),
(namespaces['html'], 'blockquote'),
(namespaces['html'], 'body'),
(namespaces['html'], 'br'),
(namespaces['html'], 'button'),
(namespaces['html'], 'caption'),
(namespaces['html'], 'center'),
(namespaces['html'], 'col'),
(namespaces['html'], 'colgroup'),
(namespaces['html'], 'command'),
(namespaces['html'], 'dd'),
(namespaces['html'], 'details'),
(namespaces['html'], 'dir'),
(namespaces['html'], 'div'),
(namespaces['html'], 'dl'),
(namespaces['html'], 'dt'),
(namespaces['html'], 'embed'),
(namespaces['html'], 'fieldset'),
(namespaces['html'], 'figure'),
(namespaces['html'], 'footer'),
(namespaces['html'], 'form'),
(namespaces['html'], 'frame'),
(namespaces['html'], 'frameset'),
(namespaces['html'], 'h1'),
(namespaces['html'], 'h2'),
(namespaces['html'], 'h3'),
(namespaces['html'], 'h4'),
(namespaces['html'], 'h5'),
(namespaces['html'], 'h6'),
(namespaces['html'], 'head'),
(namespaces['html'], 'header'),
(namespaces['html'], 'hr'),
(namespaces['html'], 'html'),
(namespaces['html'], 'iframe'),
# Note that image is commented out in the spec as "this isn't an
# element that can end up on the stack, so it doesn't matter,"
(namespaces['html'], 'image'),
(namespaces['html'], 'img'),
(namespaces['html'], 'input'),
(namespaces['html'], 'isindex'),
(namespaces['html'], 'li'),
(namespaces['html'], 'link'),
(namespaces['html'], 'listing'),
(namespaces['html'], 'marquee'),
(namespaces['html'], 'menu'),
(namespaces['html'], 'meta'),
(namespaces['html'], 'nav'),
(namespaces['html'], 'noembed'),
(namespaces['html'], 'noframes'),
(namespaces['html'], 'noscript'),
(namespaces['html'], 'object'),
(namespaces['html'], 'ol'),
(namespaces['html'], 'p'),
(namespaces['html'], 'param'),
(namespaces['html'], 'plaintext'),
(namespaces['html'], 'pre'),
(namespaces['html'], 'script'),
(namespaces['html'], 'section'),
(namespaces['html'], 'select'),
(namespaces['html'], 'style'),
(namespaces['html'], 'table'),
(namespaces['html'], 'tbody'),
(namespaces['html'], 'td'),
(namespaces['html'], 'textarea'),
(namespaces['html'], 'tfoot'),
(namespaces['html'], 'th'),
(namespaces['html'], 'thead'),
(namespaces['html'], 'title'),
(namespaces['html'], 'tr'),
(namespaces['html'], 'ul'),
(namespaces['html'], 'wbr'),
(namespaces['html'], 'xmp'),
(namespaces['svg'], 'foreignObject')
))
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 3
- Comments: 16 (10 by maintainers)
User (CPU) time running over first example above, measured at every yapf commit:
Perhaps this/these should be added as a (timed) test?
@campos-ddc I believe this is no longer an issue. Any new slow examples should file new bugs. ๐
Quite alright. ๐ Itโs good to know where weโre doing less than good.