[elixir-core:9179] Re: [Proposal] Kernel.if_match/2 - A happy medium between `if` and `case`

2019-10-17 Thread Michael St Clair
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

Re: [elixir-core:9191] [Proposal] Kernel.if_match/2 - A happy medium between `if` and `case`

2019-10-17 Thread Michael St Clair
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

Re: [elixir-core:9192] [Proposal] Kernel.if_match/2 - A happy medium between `if` and `case`

2019-10-17 Thread Michael St Clair
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

Re: [elixir-core:9184] [Proposal] Kernel.if_match/2 - A happy medium between `if` and `case`

2019-10-17 Thread Michael St Clair
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

Re: [elixir-core:9163] Running phoenix locally in Docker on Mac

2019-10-14 Thread Michael St Clair
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

Re: [elixir-core:9169] Running phoenix locally in Docker on Mac

2019-10-14 Thread Michael St Clair
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

Re: [elixir-core:9162] Running phoenix locally in Docker on Mac

2019-10-14 Thread Michael St Clair
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

Re: [elixir-core:9165] Running phoenix locally in Docker on Mac

2019-10-14 Thread Michael St Clair
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

Re: [elixir-core:9171] Running phoenix locally in Docker on Mac

2019-10-14 Thread Michael St Clair
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)

Re: [elixir-core:9319] Running phoenix locally in Docker on Mac

2020-01-14 Thread Michael St Clair
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

Re: [elixir-core:9318] Running phoenix locally in Docker on Mac

2020-01-14 Thread Michael St Clair
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')