Skip to content

Optimizations, correctly handle stdout - #72

Open
Aloso wants to merge 1 commit into
adam-mcdaniel:mainfrom
Aloso:pipe-stdout
Open

Optimizations, correctly handle stdout#72
Aloso wants to merge 1 commit into
adam-mcdaniel:mainfrom
Aloso:pipe-stdout

Conversation

@Aloso

@Aloso Aloso commented Oct 27, 2021

Copy link
Copy Markdown
Contributor

Fixes #71. Closes #70.

This PR adds a variable to the environment that tracks whether the currently evaluated expression's output should be printed directly or stored in a string. This is done to allow things like let x = which vim or "[" + (hostname ()) + "]".

I also refactored some parts to clone objects less often, allocate fewer Boxes and Vecs and use .to_string() instead of format!("{}", ..) when possible.

I replaced occurrences of impl ToString with impl Into<String> or just String, because ToString uses the Display implementation which might be more expensive.

@cognivore

Copy link
Copy Markdown

👀

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

Successfully merging this pull request may close these issues.

Storing output of commands doesn't work Using backtick

2 participants