Is there a reason or limitation `if` couldn't be changed to handle this
instead of throwing a NoMatchError?
--
You received this message because you are subscribed to the Google Groups
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
n
> kelvin@me.com
>
> On Oct 17, 2019, at 16:24, Michael St Clair > wrote:
>
> With does seem like the right thing in this case.
>
> Although to add I don't think I have ever done pattern matching in an if
> for this reason. Seems like if you are wrapping pattern ma
I would expect it
>> to be on something like:
>>
>> if %{bar: “baz”} <- foo do
>> “hello i match”
>> end
>>
>> Best,
>> Kelvin Stinghen
>> kelvin@me.com
>>
>> On Oct 17, 2019, at 16:24, Michael St Clair > > wro
With does seem like the right thing in this case.
Although to add I don't think I have ever done pattern matching in an if
for this reason. Seems like if you are wrapping pattern matching in an if
you want to know if the match works. I think supporting `<-` in an `if`
would be good if there
R
>
>
> On Mon, Oct 14, 2019 at 8:29 PM Michael St Clair <mailto:michaels...@gmail.com>> wrote:
> What is the best way to experiment with that? As I am showing that using the
> ls command is much faster (times below)
>
> On my Mac:
> iex(3)> fn -> Path.wi
I can check later this afternoon. But doesn't the improvement come with
only having to call :os.cmd once with `ls lib/**/*.ex`?
--
You received this message because you are subscribed to the Google Groups
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from
l./(1_000_000)
0.031241
On Monday, October 14, 2019 at 12:14:57 PM UTC-6, José Valim wrote:
>
> There is no way to patch out Mix.Utils to run your own code. The proper
> fix would be to figure out why the path traversal is slow on Elixir (it is
> implemented on top of filelib:wildcard) so
nd see if that is
> enough to reproduce the issue. Then I would implement a C script that calls
> ls as a NIF, see if it is fast or not. And so on.
>
>
> *José Valim*
> www.plataformatec.com.br
> Skype: jv.ptec
> Founder and Director of R
>
>
> On Mon, Oct 14, 20
On my Mac :os.cmd is way slower (I can test on docker later this afternoon
if needed, but I assume we would see something similar).
iex(8)> fn -> Enum.each(0..500, fn _ -> :os.cmd('ls lib/utils') |>
to_string() |> String.split("\n") end) end |> :timer.tc |> elem(0) |>
Kernel./(1_000_000)
Running File.ls many times and seeing how fast it was gave me an idea. So I
wrote this code and benchmarked it.
defmodule Benchmark do
def run(function) do
function |> :timer.tc() |> elem(0) |> Kernel./(1_000_000)
end
end
defmodule MyFile do
def list(directory, filter) do
I finally tested this in Docker the results were strange, File.ls is still
faster but not by as much.
iex(20)> fn -> Enum.each(0..500, fn _ -> File.ls("lib/utils") end) end |>
:timer.tc |> elem(0) |> Kernel./(1_000_000)
1.05333
iex(21)> fn -> Enum.each(0..500, fn _ -> :os.cmd('ls lib/utils')
11 matches
Mail list logo