Read file input in bytes instead of string #979
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This Pull Request is a follow-up PR for #915, which closes #876.
This PR may also improve run-time performance slightly since it removes the unnecessary bytes to utf8 chars conversion when reading the files.
It changes the following:
boa_cli
)Except for file input in
boa_cli
, all the other places still take input in str and convert it to bytes afterward:boa_cli
command promptThe crate
rustyline
reads input in strings and takes care of it.boa_wasm
wasm_bindgen
makes JS interface and takes input in strings.test/benchmark
The benchmark still uses
include_str!
to read the bench scripts. Since the files are read in compile-time, it does not affect the run-time performance. Keep it as it can also benefit because it checks if there are any invalid chars in the bench scripts in compile time.Similar reasons for tests. Taking the input in str makes the tests simpler and clearer.