-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from Reselim/buffer
Rewrite to use buffers
- Loading branch information
Showing
3 changed files
with
153 additions
and
105 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ A pretty fast Luau Base64 encoder | |
Add the following to your `wally.toml` under `[dependencies]`: | ||
|
||
```toml | ||
base64 = "reselim/base64@2.0.3" | ||
base64 = "reselim/base64@3.0.0" | ||
``` | ||
|
||
### Manual | ||
|
@@ -21,20 +21,22 @@ base64 = "reselim/[email protected]" | |
```lua | ||
local Base64 = require(path.to.Base64) | ||
|
||
local data = "Hello, world!" | ||
local data = buffer.fromstring("Hello, world!") | ||
|
||
local encodedData = Base64.encode(data) -- "SGVsbG8sIHdvcmxkIQ==" | ||
local decodedData = Base64.decode(encodedData) -- "Hello, world!" | ||
local encodedData = Base64.encode(data) -- buffer: "SGVsbG8sIHdvcmxkIQ==" | ||
local decodedData = Base64.decode(encodedData) -- buffer: "Hello, world!" | ||
|
||
print(buffer.tostring(decodedData)) -- "Hello, world!" | ||
``` | ||
|
||
## Benchmarks | ||
|
||
Benchmarks ran in Roblox Studio with a payload of **10,000,000** characters running on a **Ryzen 5900X** and **32GB RAM @ 3200MHz**, as of **2023/11/03** | ||
Benchmarks ran in Roblox Studio with a payload of **100,000,000** characters running on a **Ryzen 5900X** and **32GB RAM @ 3200MHz**, as of **2024/01/11** | ||
|
||
#### Native mode OFF: | ||
- Encode: 569.976ms (17,544,586/s) | ||
- Decode: 333.244ms (30,008,033/s) | ||
- Encode: 3303.27ms (30,273,037/s) | ||
- Decode: 3747.17ms (26,686,826/s) | ||
|
||
#### Native mode ON: | ||
- Encode: 365.399ms (27,367,321/s) | ||
- Decode: 166.880ms (59,923,405/s) | ||
- Encode: 461.23ms (216,813,496/s) | ||
- Decode: 596.37ms (167,680,012/s) |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[package] | ||
name = "reselim/base64" | ||
description = "A pretty fast Luau Base64 encoder" | ||
version = "2.0.3" | ||
version = "3.0.0" | ||
registry = "https://github.com/UpliftGames/wally-index" | ||
realm = "shared" | ||
include = ["default.project.json", "Base64.lua"] |