Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace handlebars with string replace #6

Open
dsherret opened this issue Feb 20, 2022 · 1 comment
Open

Replace handlebars with string replace #6

dsherret opened this issue Feb 20, 2022 · 1 comment

Comments

@dsherret
Copy link
Member

dsherret commented Feb 20, 2022

Not a big deal, but I think we could replace handlebars with a few string replaces or a custom function that handles it.

$ cargo bloat --release --crates

 File  .text     Size Crate
12.9%  43.4% 367.8KiB std
 7.6%  25.5% 216.2KiB handlebars
 3.5%  11.8%  99.7KiB tokio
 1.6%   5.5%  46.8KiB dprint_plugin_exec
 1.3%   4.2%  35.8KiB serde_json
 0.8%   2.6%  21.7KiB dprint_core
 0.5%   1.7%  14.2KiB parking_lot
 0.3%   1.1%   9.5KiB serde
 0.2%   0.8%   6.9KiB pest
 0.2%   0.7%   6.1KiB num_cpus
 0.1%   0.4%   3.5KiB anyhow
 0.1%   0.3%   2.5KiB parking_lot_core
 0.1%   0.2%   1.9KiB [Unknown]
 0.1%   0.2%   1.5KiB signal_hook_registry
 0.0%   0.2%   1.3KiB once_cell
 0.0%   0.1%   1.2KiB splitty
 0.0%   0.1%   1.1KiB memchr
 0.0%   0.0%     430B smallvec
 0.0%   0.0%     310B mio
29.6% 100.0% 848.1KiB .text section size, the file size is 2.8MiB

After:

$ cargo bloat --release --crates

 File  .text     Size Crate
13.1%  58.2% 324.5KiB std
 4.0%  17.8%  99.4KiB tokio
 1.5%   6.5%  36.2KiB dprint_plugin_exec
 0.9%   4.2%  23.4KiB serde_json
 0.9%   4.0%  22.4KiB dprint_core
 0.6%   2.5%  14.2KiB parking_lot
 0.4%   1.7%   9.5KiB serde
 0.2%   1.1%   6.1KiB num_cpus
 0.1%   0.6%   3.5KiB anyhow
 0.1%   0.4%   2.5KiB parking_lot_core
 0.1%   0.3%   1.9KiB [Unknown]
 0.1%   0.3%   1.6KiB signal_hook_registry
 0.1%   0.2%   1.3KiB once_cell
 0.0%   0.2%   1.2KiB splitty
 0.0%   0.2%   1.1KiB memchr
 0.0%   0.1%     430B smallvec
 0.0%   0.1%     310B mio
22.4% 100.0% 557.1KiB .text section size, the file size is 2.4MiB
@dsherret
Copy link
Member Author

Actually, I'm not sure. How would something like providing a CLI flag or not work (ex. provide --use-tabs only when {{use_tabs}} is true)? I believe this is possible with handlebars?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant