Skip to content

Commit

Permalink
chore: update bench
Browse files Browse the repository at this point in the history
  • Loading branch information
sanyuan0704 committed Sep 21, 2023
1 parent 94174b4 commit 422fd75
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ It can be 10x+ faster than compiler in pure JavaScript version.The [benchmark](.

| Tool | Time Spend |
| --------------- | ---------- |
| @rspress/mdx-rs | 163 ms |
| @mdx-js/mdx | 3288 ms |
| @rspress/mdx-rs | 977 ms |
| @mdx-js/mdx | 21300 ms |

We forked [mdxjs-rs](https://github.com/wooorm/mdxjs-rs), the Rust version of mdx compiler and customize it for Modern.js Doc, adding the following features:

Expand Down
4 changes: 2 additions & 2 deletions benches/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ const content = fs.readFileSync(examplePath, "utf-8");

async function benchMdxjs() {
await Promise.all(
new Array(800).fill(0).map(async (_, index) => {
new Array(5000).fill(0).map(async (_, index) => {
await compileByMdxJs(content);
})
);
}

async function benchMdxRs() {
await Promise.all(
new Array(800).fill(0).map(async (_, index) => {
new Array(5000).fill(0).map(async (_, index) => {
await compileByMdxRs({
value: content,
filepath: "",
Expand Down
30 changes: 15 additions & 15 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@
/* auto-generated by NAPI-RS */

export interface Toc {
text: string;
id: string;
depth: number;
text: string
id: string
depth: number
}
export interface Output {
code: string;
links: Array<string>;
html: string;
title: string;
toc: Array<Toc>;
frontmatter: string;
code: string
links: Array<string>
html: string
title: string
toc: Array<Toc>
frontmatter: string
}
export interface CompileOptions {
value: string;
filepath: string;
development: boolean;
root: string;
value: string
filepath: string
development: boolean
root: string
}
/** Turn MDX into JavaScript. */
export function compile(options: CompileOptions): Promise<Output>;
export function compileSync(options: CompileOptions): Output;
export function compile(options: CompileOptions): Promise<Output>
export function compileSync(options: CompileOptions): Output

0 comments on commit 422fd75

Please sign in to comment.