Skip to content

Commit

Permalink
Clarified the async FAQ a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
LeaVerou committed Jul 30, 2012
1 parent 3ee5116 commit cdd83b2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions faq.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,12 @@ <h1>Why is asynchronous highlighting disabled by default?</h1>

<p>Web Workers are good for preventing syntax highlighting of really large code blocks from blocking the main UI thread.
In most cases, you will want to highlight reasonably sized chunks of code, and this will not be needed.
Furthermore, using Web Workers is actually <strong>slower</strong> than synchronously highlighting, it just appears faster
in some cases because it doesn’t block the main thread.
Also, Web Workers cannot interact with the DOM and most other APIs (e.g. the console), so they are notoriously hard to debug.</p>
Furthermore, using Web Workers is actually <strong>slower</strong> than synchronously highlighting, due to the overhead of creating and terminating
the Worker. It just appears faster in these cases because it doesn’t block the main thread.
In addition, since Web Workers operate on files instead of objects, plugins that hook on core parts of Prism (e.g. modify language definitions)
will not work unless included in the same file (using the builder in the <a href="download.html">Download</a> page will protect you from this pitfall).
Lastly, Web Workers cannot interact with the DOM and most other APIs (e.g. the console), so they are notoriously hard to debug.
</p>
</section>

<section>
Expand Down

0 comments on commit cdd83b2

Please sign in to comment.