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

rubocop-headquarters-2018.pdf

 rubocop-headquarters-2018.pdf

Rails Developers Meetup 2018 Day 3 Extreme (https://techplay.jp/event/679666)

Koichi ITO

July 14, 2018
Tweet

More Decks by Koichi ITO

Other Decks in Programming

Transcript

  1. w 3VCP$PQ$PSF w 3VCP$PQ1FSGPSNBODF w 3VCP$PQ3BJMT w 3VCP$PQ34QFD w 3VCZ4UZMF(VJEF

    w 3BJMT4UZMF(VJEF w 3VCP$PQ+1 w FUD 3VCP$PQ)2ͷSFQP
  2. 044ίϛϡχςΟʹΑΔҧ͍ SBJMTSBJMT CCBUTPWSVCPDPQ 3FWJFX ؔ৺Λ࣋ͬͨਓ ؔ৺Λ࣋ͬͨਓ $MPTF JTTVF *TTVFνʔϜɺίϛολʔɺί Ξϝϯόʔ

    ίϛολʔ .FSHF13 ίϛολʔɺίΞϝϯόʔ ΄΅ϦϙδτϦΦʔφʔ NBTUFS QVTI ίϛολʔɺίΞϝϯόʔ ϦϙδτϦΦʔφʔͷΈ ؍ଌൣғ 3FMFBTF ϦϦʔεϚωʔδϟ ϦϙδτϦΦʔφʔ
  3. ࢲ͕ۙະདྷʹඳ͘3VCP$PQ)2ͷੈք؍ SBJMTSBJMT SVCPDPQIRSVCPDPQ 3FWJFX ؔ৺Λ࣋ͬͨਓ ؔ৺Λ࣋ͬͨਓ $MPTF JTTVF *TTVFνʔϜɺίϛολʔɺί Ξϝϯόʔ

    ίϛολʔ .FSHF13 ίϛολʔɺίΞϝϯόʔ ίϛολʔ NBTUFS QVTI ίϛολʔɺίΞϝϯόʔ ίϛολʔ 3FMFBTF ϦϦʔεϚωʔδϟ ϔουϝϯςφʔ 0S
  4. QPDLF .ZHPBMGPSUIJTPSHBOJ[BUJPOJTUPCFDPNFUIF DFOUSBMIVCGPSBMMUIFDPSF3VCP$PQSFMBUFE BDUJWJUJFT*XBOUVTUPCVJMEBCJHHFSDPSFUFBN TOJQ  *UIBTO`UCFFOBQFSTPOBMQSPKFDUPGNJOFGPSRVJUF BXIJMF*GTPNBOZQFPQMFBSFVTJOHJU JGTPNBOZ UIJOHTBSFOFFEFEUPCFEPOF

    UIJTCFMPOHTUPUIF DPNNVOJUZ IUUQTCMPHTJEFDJDPNJOUFSWJFXXJUICP[IJEBSCBUTPWCCGEB :FTUFSEBZ ZPVNPWFE3VCP$PQSFQPTJUPSZGSPN VOEFSCCBUPTWUPSVCPDPQIR TOJQ  $BOZPVUFMMVTPUIFSQMBOTGPSUIFPSHBOJ[BUJPO CCBUTPW *OUFSWJFXXJUI#P[IJEBS#BUTPW 1SFTFOUFECZ4JEFS5FBN
  5. $PNQBSJTPO % ruby -v shuffle-first-vs-sample.rb ruby 2.5.1p57 (2018-03-29 revision 63029)

    [x86_64- darwin17] Warming up -------------------------------------- Array#shuffle.first 35.171k i/100ms Array#sample 229.945k i/100ms Calculating ------------------------------------- Array#shuffle.first 400.180k (± 5.9%) i/s - 2.005M in 5.026934s Array#sample 6.407M (± 6.4%) i/s - 31.962M in 5.010117s Comparison: Array#sample: 6407183.3 i/s Array#shuffle.first: 400180.2 i/s - 16.01x slower
  6. w 7FSTJPO"EEFEʜ$PQ͕௥Ճ͞Εͨόʔδϣ ϯ w 7FSTJPO$IBOHFEʜϢʔβʔʹӨڹͷ͋Δόʔ δϣϯ ৽͍͠ઃఆɺσϑΥϧτͷมߋ  w 7FSTJPO3FNPWFEʜ࡟আ͞Εͨόʔδϣϯ

    w 4BGFʜِཅੑͳͲͳ͘ઃܭͲ͓Γʹ৴པͰ͖Δ w 4BGF"VUP$PSSFDUʜࣗಈमਖ਼ͰյΕ͍ͯͳ͍ ͭͷϝλσʔλ