Clarifying performance expectations about sass and sass-embedded (#3716)

This commit is contained in:
なつき 2023-10-10 17:17:28 -07:00 committed by Natalie Weizenbaum
parent 4fc5a9511a
commit 0b8a9b84b6
2 changed files with 25 additions and 9 deletions

View File

@ -44,6 +44,11 @@ export interface CompileResult {
*
* This only allows synchronous {@link Importer}s and {@link CustomFunction}s.
*
* **Heads up!** When using the `sass-embedded` npm package,
* **{@link compileAsync} is almost always faster than {@link compile}**, due to
* the overhead of emulating synchronous messaging with worker threads and
* concurrent compilations being blocked on main thread.
*
* @example
*
* ```js
@ -66,9 +71,9 @@ export function compile(path: string, options?: Options<'sync'>): CompileResult;
* This only allows synchronous or asynchronous {@link Importer}s and
* {@link CustomFunction}s.
*
* **Heads up!** When using Dart Sass, **{@link compile} is almost twice as fast
* as {@link compileAsync}**, due to the overhead of making the entire
* evaluation process asynchronous.
* **Heads up!** When using the `sass` npm package, **{@link compile} is almost
* twice as fast as {@link compileAsync}**, due to the overhead of making the
* entire evaluation process asynchronous.
*
* @example
*
@ -94,6 +99,12 @@ export function compileAsync(
*
* This only allows synchronous {@link Importer}s and {@link CustomFunction}s.
*
* **Heads up!** When using the `sass-embedded` npm package,
* **{@link compileStringAsync} is almost always faster than
* {@link compileString}**, due to the overhead of emulating synchronous
* messaging with worker threads and concurrent compilations being blocked on
* main thread.
*
* @example
*
* ```js
@ -125,9 +136,9 @@ export function compileString(
* This only allows synchronous or asynchronous {@link Importer}s and {@link
* CustomFunction}s.
*
* **Heads up!** When using Dart Sass, **{@link compile} is almost twice as fast
* as {@link compileAsync}**, due to the overhead of making the entire
* evaluation process asynchronous.
* **Heads up!** When using the `sass` npm package, **{@link compileString} is
* almost twice as fast as {@link compileStringAsync}**, due to the overhead
* of making the entire evaluation process asynchronous.
*
* @example
*

View File

@ -96,6 +96,11 @@ export interface LegacyResult {
* This function synchronously compiles a Sass file to CSS. If it succeeds, it
* returns the result, and if it fails it throws an error.
*
* **Heads up!** When using the `sass-embedded` npm package, **{@link render}
* is almost always faster than {@link renderSync}**, due to the overhead of
* emulating synchronous messaging with worker threads and concurrent
* compilations being blocked on main thread.
*
* @example
*
* ```js
@ -116,9 +121,9 @@ export function renderSync(options: LegacyOptions<'sync'>): LegacyResult;
* `callback` with a {@link LegacyResult} if compilation succeeds or {@link
* LegacyException} if it fails.
*
* **Heads up!** When using Dart Sass, **{@link renderSync} is almost twice as
* fast as {@link render}** by default, due to the overhead of making the entire
* evaluation process asynchronous.
* **Heads up!** When using the `sass` npm package, **{@link renderSync} is
* almost twice as fast as {@link render}** by default, due to the overhead of
* making the entire evaluation process asynchronous.
*
* ```js
* const sass = require('sass'); // or require('node-sass');