Skip to content
  • Author Maintainer

    @pacoguzman Few things:

    • I think we just need if @populated, without the || overflow?, since overflow? would itself call populate!, so at that point returning @array.size or calling count wouldn't make a difference, I think.
    • Would it make sense to set @populated from count since we know it runs through the entire loop?
    • #real_size doesn't need to call populate! and check if @overflow, it can just do if overflow?
    • What's the reason for diffs.instance_eval { @array.sum(&:added_lines) } vs diffs.sum(&:added_lines)?
  • Contributor

    Thanks @DouweM what I noticed just trying the previous code in the console is that iterating through the raw collection (@iterator) thing that we always do even when we already populated the @array instance is slow. Probably because rugged is still doing things under the hood, that's why I get some speed boost adding more checks in the code and using @array instead.

    @array.size vs count is a win based in my comment above, I would like to measure this isolated but a 3x speed boost in the benchmark above is a thing to notice

0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment