Skip to content

Commit

Permalink
Remove Rayon dependency
Browse files Browse the repository at this point in the history
With the move to storing sprites as parsed SVG trees instead of pixmaps
(to support metadata), the data structures are no longer thread-safe.
Since adding Rayon was more fun than necessity, I'm just going to remove
it (Spreet now takes 10ms longer to render the osm-bright-gl-style
spritesheet, for example).
  • Loading branch information
flother committed Oct 5, 2023
1 parent c01674a commit b94d095
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- Fix bug that meant URLs in SVG `<image>` elements were resolved relative to the current working directory, not to the SVG itself (see [#60](https://github.com/flother/spreet/issues/60))
- Update [resvg](https://crates.io/crates/resvg) dependency to v0.35
- Update [clap](https://crates.io/crates/clap) dependency to v4.4
- Update [Rayon](https://crates.io/crates/rayon) dependency to v1.8
- Remove [Rayon](https://crates.io/crates/rayon) dependency. This means the Spreet CLI no longer parses SVGs in parallel, but that was a fun-but-unnecessary optimisation in the first place that generally saved only a handful of milliseconds

Because of the change to Rayon, Spreet's minimum Rust version is now 1.63.0 (released August 2022).

Expand Down
1 change: 0 additions & 1 deletion Cargo.lock

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

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ categories = ["command-line-utilities", "encoding", "filesystem", "graphics"]

[features]
default = ["cli"]
cli = ["dep:clap", "dep:exitcode", "dep:rayon"]
cli = ["dep:clap", "dep:exitcode"]

[dependencies]
clap = { version = "4.4", features = ["derive"], optional = true }
Expand All @@ -22,7 +22,6 @@ exitcode = { version = "1.1", optional = true }
multimap = "0.9"
oxipng = { version = "8.0", features = ["parallel", "zopfli", "filetime"], default-features = false }
png = "0.17"
rayon = { version = "1.8", optional = true }
resvg = "0.35"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Compared to other tools for creating spritesheets from SVGs, Spreet:

- outputs smaller spritesheets (both fewer pixels and fewer bytes)
- is a self-contained ~2.2 MB binary
- is faster (multi-threaded)
- is faster

_Spreet_ (also _spreit_, _spret_, _sprit_) is the [Scots](https://en.wikipedia.org/wiki/Scots_language) word for a sprite, the fairy-like creature from Western folklore.

Expand Down
2 changes: 0 additions & 2 deletions src/bin/spreet/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::collections::BTreeMap;

use clap::Parser;
// use rayon::prelude::*;

use spreet::fs::{get_svg_input_paths, load_svg};
use spreet::sprite;
Expand All @@ -21,7 +20,6 @@ fn main() {
// bitmapped SVGs will be added to the spritesheet, and the keys will be used as the unique
// sprite ids in the JSON index file.
let sprites = get_svg_input_paths(&args.input, args.recursive)
// .par_iter()
.iter()
.map(|svg_path| {
if let Ok(svg) = load_svg(svg_path) {
Expand Down

0 comments on commit b94d095

Please sign in to comment.