Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Laravel Collectionの計算量を調べてみた

Ryo Tomidokoro
September 26, 2018

Laravel Collectionの計算量を調べてみた

Laravel Collectionの各メソッドの計算量を確認してみた。

Ryo Tomidokoro

September 26, 2018
Tweet

More Decks by Ryo Tomidokoro

Other Decks in Programming

Transcript

  1. Oه๏ O(1) O(log n) O(n) O(n * log n) O(n^2)

    ϓϩάϥϜͷ࣌ؒతܭࢉྔΛද͢
  2. ཁ஫ҙϝιου • collapse O(n^2) • crossJoin O(n^3) • diff O(n^t)

    • diffAssoc O(n^t) • flatMap O(n^2) • flatten O(n^2) • groupBy O(n^2) • intersect O(n^2)
  3. where - O(n)       

       ॲཧ࣌ؒ(ඵ) σʔλ݅਺
  4. count - O(1)       

       ॲཧ࣌ؒ(ඵ) σʔλ݅਺
  5. collapse - O(n^2)       

        ॲཧ࣌ؒ(ඵ) σʔλ݅਺
  6. crossJoin - O(n^3)       

       ॲཧ࣌ؒ(ඵ) σʔλ݅਺
  7. diff - O(n^t)       

       ॲཧ࣌ؒ(ඵ) σʔλ݅਺ t͸field਺ʹґଘ͢Δ
  8. σʔλྔʹΑΔੑೳͷྼԽ         

          ॲཧ࣌ؒ(ඵ) σʔλ݅਺ (ୈ1,2 Ҿ਺ಉ͡)