Re: [elixir-core:11697] Performance of regular expression matches

2024-03-14 Thread José Valim
Do you have benchmarks or only the fprof results? fprof is not a benchmarking tool: comparing fprof results from different code may be misleading. Proper benchmarking is preferrable. I am benchmarking locally and I cannot measure any relevant difference even with the whole version checking

Re: [elixir-core:11697] Performance of regular expression matches

2024-03-14 Thread Jan Krüger
Thanks a lot. I'm also happy to share our case, and my fprof results, if that helps. I am very sure that my erlang, and elixir versions match, on the machine where I've tested this. Replacing Regex.run with an identical call to :re.run should show the performance improvement I've mentioned. The

Re: [elixir-core:11696] Performance of regular expression matches

2024-03-14 Thread 'marcel...@googlemail.com' via elixir-lang-core
I'm the maintainer of RDF.ex library with the RDF.IRI module mentioned in the OP. I can confirm that this fix doesn't affect the problem, since we're actually not using `URI.parse/1` most of the time (we use it only when dealing with relative URIs). Even in this case the `Regex.version/0` call

Re: [elixir-core:11694] Performance of regular expression matches

2024-03-14 Thread José Valim
I will benchmark but I would be very surprised if :re.version() is the one to blame. It takes 3-4us on my machine. On Thu, Mar 14, 2024 at 5:15 PM Jan Krüger wrote: > I read the commit, and I don't it fixes what our actual problem was. See > my comment above. The problem is the actual call to

Re: [elixir-core:11694] Performance of regular expression matches

2024-03-14 Thread Jan Krüger
I read the commit, and I don't it fixes what our actual problem was. See my comment above. The problem is the actual call to :re.version, not the recompilation of the regex On Thursday, March 14, 2024 at 4:37:43 PM UTC+1 José Valim wrote: > I have pushed a fix to main. But also note we provide

Re: [elixir-core:11693] Performance of regular expression matches

2024-03-14 Thread Jan Krüger
True, but reading the regex module code, it seems like the call to :re.version would always get made, regardless of which elixir/erlang version is in use? I'm quite confident that in all our environments the elixir and OTP versions match, so it's not that Regex.run is slow because it ends up

Re: [elixir-core:11691] Performance of regular expression matches

2024-03-14 Thread José Valim
I have pushed a fix to main. But also note we provide precompiled Elixir versions per OTP version. Using a matching version will always give you the best results and that's not only about regexes. :) On Thu, Mar 14, 2024 at 2:20 PM Jan Krüger wrote: > I've recently had to work on a code base

[elixir-core:11691] Performance of regular expression matches

2024-03-14 Thread Jan Krüger
I've recently had to work on a code base that parses largish RDF XML files. Part of the code base does relatively simple but regular expression matches, but since the files are large, quite a lot of Regex.run calls. While profiling I've noticed, that there are callouts to :erlang.system_info,