-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
buffer.toString("base64")
4x faster (#3486)
* Add libbase64 * Add bench * Update licensing.md --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
- Loading branch information
1 parent
a2cca6e
commit 6cae6eb
Showing
8 changed files
with
78 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { bench, run } from "./runner.mjs"; | ||
import { Buffer } from "node:buffer"; | ||
|
||
const bigBuffer = Buffer.from("hello world".repeat(10000)); | ||
const converted = bigBuffer.toString("base64"); | ||
bench("Buffer.toString('base64')", () => { | ||
return bigBuffer.toString("base64"); | ||
}); | ||
|
||
// bench("Buffer.from(str, 'base64')", () => { | ||
// return Buffer.from(converted, "base64"); | ||
// }); | ||
|
||
await run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters