question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pathologically slow example

See original GitHub issue

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')
))

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:3
  • Comments:16 (10 by maintainers)

github_iconTop GitHub Comments

8reactions
chknocommented, May 27, 2016

User (CPU) time running over first example above, measured at every yapf commit: yapf-speed

2reactions
haydcommented, May 26, 2016

Perhaps this/these should be added as a (timed) test?

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Abnormal EEG - NCBI Bookshelf - NCBI - NIH
Focal slow wave activity on the EEG is indicative of focal cerebral pathology of the underlying brain region. Slowing may be intermittent or...
Read more >
Bradyphrenia - an overview | ScienceDirect Topics
Bradyphrenia is defined as a pathological slowing of mental processes. From: Reference Module in Neuroscience and Biobehavioral Psychology, 2017. Related terms:.
Read more >
Physiological and pathological tremors and rhythmic central ...
Introduction. Tremor, defined as a rapid back-and-forth movement of a body part, is a readily apparent and easily quantified motor phenomenon found both...
Read more >
bradycardia | pathology - Encyclopedia Britannica
bradycardia, type of arrhythmia (abnormal heart rhythm) characterized by slowing of the heart rate to 60 beats per minute or less.
Read more >
Pathology - Definition, Meaning & Synonyms - Vocabulary.com
We also use pathology to describe abnormal conditions that aren't really diseases, like the pathology of Hollywood stars who live their lives in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found