Skip to content

Commit

Permalink
use faster base64 and upgrade packages
Browse files Browse the repository at this point in the history
  • Loading branch information
lockieluke committed Mar 9, 2024
1 parent a793630 commit a7fb4ca
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 21 deletions.
44 changes: 30 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,19 @@ repository = "https://github.com/ciderapp/swift-precompiler"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
base64 = "0.21.7"
clap = { version = "4.4.14", features = ["derive"] }
colored = "2.1.0"
fancy-regex = "0.13.0"
glob = "0.3.1"
path-absolutize = "3.1.1"
toml = "0.8.8"
serde = { version = "1.0.195", features = ["derive"] }
toml = "0.8.10"
serde = { version = "1.0.197", features = ["derive"] }
base64-simd = "0.8.0"

[[bin]]
name = "swift-precompiler"

[profile.release]
lto = true
opt-level = 3
lto = "fat"
codegen-units = 1
4 changes: 1 addition & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ use std::path::{Path, PathBuf};
use std::process::exit;
use std::time::Instant;

use base64::Engine;
use base64::prelude::BASE64_STANDARD;
use clap::{Parser, Subcommand, ValueHint};
use colored::Colorize;
use fancy_regex::Regex;
Expand Down Expand Up @@ -222,7 +220,7 @@ fn main() {
precompile_file_data = precompile_file_data.replace(&*format!("// <{}>", placeholder), &*format!("\
// <{}>
case \"{}\":
content = \"{}\"\n", placeholder, include_str_og_path.as_str(), BASE64_STANDARD.encode(content_of_file.to_owned())));
content = \"{}\"\n", placeholder, include_str_og_path.as_str(), base64_simd::STANDARD.encode_to_string(content_of_file.to_owned())));
});
}

Expand Down

0 comments on commit a7fb4ca

Please sign in to comment.