Matching with is_binary once is a slight performance gain, only
noticeable on long numbers. It also makes the FunctionClauseError more
clear: `** (FunctionClauseError) no function clause matching in
Integer.parse/2` vs `** (FunctionClauseError) no function clause
matching in Integer.count_digits/2`
The previous version would not terminate if
the program being invoked terminated. The
new version addresses this at the cost of
starting a background process for stdin
reading.
Closes#9171.
* Remove extraneous guard from String.split
This clause makes sense for `pattern` satisfying any of the types
defined in the spec, that is `binary`, `[binary]` and `:binary.cp()`.
Furthermore the guard for `pattern` is not specified in any of the other
clauses.
Additionally, the `or` in the guard seemed a bit out of place, as this
clause (and all others) needs the `string` to be binary to work.
So let's keep just the guard to check the type of the `string` and let
the `:binary.split/3' handle the types of the `pattern`.
* Unify code path in String.split
When calling `String.split` with options `parts` and/or `trim`
explicitly set to default values, different code path was taken in
comparison to when no options were given. The alternate code path has
some performance penalties as shown below, so it's better that the
"simple" case is handled always the same way.
iex(1)> lines = for _ <- 1..1_000_000, do: "a,b"
iex(2)> :timer.tc(fn -> Enum.each(lines, &String.split(&1, ",")) end)
{2254104, :ok}
iex(3)> :timer.tc(fn -> Enum.each(lines, &String.split(&1, ",", trim: false)) end)
{61426180, :ok}
This introduces five new metadata nodes:
* `do` - contains metadata about do location in a function call with
`do/end` blocks
* `end` - contains metadata about end location in a function call with
`do/end` blocks
* `closing` - contains metadata about the closing pair, such as a `}`
in a tuple or in a map, or such as the closing `)` in a function call
with parens
* `eol` - is set to true when the opening pair, such as `{` or `(`, are
followed by the end of the line
* `delimiter` - contains the opening for sigils (such as `"{"`, `"/"`,
etc)
Otherwise there are just too many warnings. However,
since we still emit a warning for :simple_one_for_one,
we give users enough feedback for them to migrate.