The reason this happens is because our list comprehensions consider everything in filters except false or nil to be true. So this additional check costs us a bit. We could certainly optimize this though, since operators (like < and >) and other BIFs are known to return just booleans, allowing us to skip this check, I just haven't got to this optimization stage (it surprises me that this check is causing all this difference though).
On Saturday, July 21, 2012 10:22:05 PM UTC+2, Alex Zatvorskiy wrote:
> Hey,
> I have been doing some benchmarks. So, I have found that elixir's *lc* at > least as slow then erlang's original feature. > There are some benchmarks:
On Sat, Jul 21, 2012 at 10:45 PM, José Valim <jose.va...@gmail.com> wrote:
> Hello Alex,
> Thanks for the benchmarks.
> The reason this happens is because our list comprehensions consider
> everything in filters except false or nil to be true.
> So this additional check costs us a bit. We could certainly optimize this
> though, since operators (like < and >) and other BIFs are known to return
> just booleans, allowing us to skip this check, I just haven't got to this
> optimization stage (it surprises me that this check is causing all this
> difference though).
> On Saturday, July 21, 2012 10:22:05 PM UTC+2, Alex Zatvorskiy wrote:
>> Hey,
>> I have been doing some benchmarks. So, I have found that elixir's *lc*at least as slow then erlang's original feature.
>> There are some benchmarks:
> On Sat, Jul 21, 2012 at 10:45 PM, José Valim <jose.va...@gmail.com> wrote:
>> Hello Alex,
>> Thanks for the benchmarks.
>> The reason this happens is because our list comprehensions consider >> everything in filters except false or nil to be true.
>> So this additional check costs us a bit. We could certainly optimize this >> though, since operators (like < and >) and other BIFs are known to return >> just booleans, allowing us to skip this check, I just haven't got to this >> optimization stage (it surprises me that this check is causing all this >> difference though).
>> On Saturday, July 21, 2012 10:22:05 PM UTC+2, Alex Zatvorskiy wrote:
>>> Hey,
>>> I have been doing some benchmarks. So, I have found that elixir's *lc*at least as slow then erlang's original feature.
>>> There are some benchmarks: