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

process.nextTick differences between node-v0.8 and node-v0.11

wagyu298
September 24, 2014

process.nextTick differences between node-v0.8 and node-v0.11

東京OtakuMode学園#1 LTスライド

wagyu298

September 24, 2014
Tweet

More Decks by wagyu298

Other Decks in Programming

Transcript

  1. QSPDFTTOFYU5JDL EJ⒎FSFODFTCFUXFFOOPEFWBOEOPEFW !XBHZV ౦ژ0UBLV.PEFֶԂ

  2. େݩͷ࿩ ʮͦ͏ͩͬͨͷ͔ʂΑ͘Θ͔ΔQSPDFTTOFYU5JDL OPEFKTͷΠϕϯτϧʔϓΛཧղ ͢Δʯ IUUQXXXTMJEFTIBSFOFUTIJHFLJ@PIUTVQSPDFTTOFYUUJDLOPEFKT  ϖʔδ໨ɺOPEFWͱOPEFWͰQSPDFTTOFYU5JDL ͷ࣮૷͕มΘΔΜ͡ΌͶʁ ͱ͍͏࿩ɻ

  3. ͰɺࠓͲ͏ͳͬͯΜͷʁ ͜Ε

  4. ࣍ͷεϥΠυWͰ͓͢͢͠͠ ҆ఆ൛͸ͲʔͳͬͯΜ͔͢Ͷʁ IUUQXXXTMJEFTIBSFOFUTIJHFLJ@PIUTVOPEFWUOH

  5. ͱ͍͏͜ͱͰ W͔ΒWͰ͜ͷล͕Ͳ͏ͳ͍ͬͯΔ͔ ࿩͍ͨ͠ͱࢥ͍·͢ɻ

  6. ͱΓ࣮͋͑ͣݧ

  7. 6TFUIF4PVSDF -VLFʜ BKT DPOTPMFMPH CFHJO  ! TFU5JNFPVU GVODUJPO \

    DPOTPMFMPH TFU5JNFPVU  ^   ! QSPDFTTOFYU5JDL GVODUJPOG \ QSPDFTTOFYU5JDL G  ^  ! DPOTPMFMPH FOE 
  8. OPEFKTW OPEFW W OPEFBKT CFHJO FOE TFU5JNFPVU TFU5JNFPVU͕ಈ͘

  9. OPEFKTW OPEFW W OPEFBKT CFHJO FOE OPEF XBSOJOH3FDVSTJWFQSPDFTTOFYU5JDLEFUFDUFE5IJTX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੍ݶ͋Γɻ w OPEFW7Ͱ+4Λ࣮ߦͨ͠௚ޙʹOFYU5JDL͕શ෦࣮ ߦ͞ΕΔɻOFYU5JDLΛ࠶ؼ͢ΔͱΠϕϯτϧʔϓ͕ࢭ·Δɻ ελοΫαΠζ੍ݶͳ͠ɻ
  13. ͜͜ࢼݧʹग़·͢ w OPEFW͸΋͏୭΋࢖ͬͯͳ͍ͱࢥ͍·͢ͷͰແࢹ͠ ·͢ɻ w OPEFWҎ߱͸OFYU5JDLΛ࠶ؼͤ͞ΔͱΠϕϯτϧʔ ϓ͕ࢭ·Δɻ w OPEFW͸͞ΒʹελοΫαΠζ੍ݶͰϓϩη ε͕མͪΔɻ

    w OPEFWͱWͰQSPDFTTOFYU5JDLͷ࣮૷͕ม ΘͬͯΔͬΆ͍ɻ
  14. ݩͷ࿩ʹ໭ͬͯ

  15. OPEFWʹ޲͚ͯJTBBDT͔ΒͷఏҊ w QSPDFTTOFYU5JDL ͰΠϕϯτϋϯυϥΛ௥Ճ ͢Δͷ͸Α͋͘Δ͜ͱ͚ͩͲɺ࣍ͷΠϕϯτϧʔ ϓͰϋϯυϥ͕ొ࿥͞ΕΔ·ͰͷؒʹΠϕϯτ ͕ൃੜͨ͠Γ͢Δͱ*0ͷऔΓ͜΅͕͠ى͖ͯ͠ ·͏ɻ

  16. ͜͏Ͱ͔͢ʁ WBS&WFOU&NJUUFSSFRVJSF FWFOUT &WFOU&NJUUFS ! GVODUJPO4PNFUIJOH'VOD SFTPVSDF/BNF \ WBSTFMGUIJT !

    QSPDFTTOFYU5JDL GVODUJPO \ TFMGFNJU TUBSU  ^  ! EP4PNFUIJOH GVODUJPO EBUB \ UIJTFNJU EBUB EBUB  ^  ^ ! 4PNFUIJOH'VODQSPUPUZQF@@QSPUP@@&WFOU&NJUUFSQSPUPUZQF ! (SBCGSPNA6OEFSTUBOEJOHQSPDFTTOFYU5JDL A IUUQIPXUPOPEFPSHVOEFSTUBOEJOHQSPDFTTOFYUUJDL w OPEFWͰ͸EP4PNFUIJOHͷ ऴ͕ྃQSPDFTTOFYU5JDLΑΓ଎ ͘ऴΘΔࣄ͕͋Δ w OPEFWҎ߱͸ؾʹ͢Δ͸ඞ ཁͳ͍
  17. ͦΕԿ͔ศརͳΜͰ͔͢ʁ WBSFOFX.Z&WFOU&NJUUFS  ! FPO TUBSU GVODUJPO \ DPOTPMFMPH TUBSU

     ^  ! FPO EBUB GVODUJPO \ DPOTPMFMPH EBUB  ^  FNJU bTUBSU` ͕OFYU5JDL͞Ε͍ͯΔͷͰɺFPO bTUBSU` ΛίϯετϥΫλͷޙ͔Βݺ ΜͰ΋FPO͕ઌʹ࣮ߦ͞ΕΔɻ
  18. OPEFWʹ޲͚ͯJTBBDT͔ΒͷఏҊ w ࣍ͷΠϕϯτ͕ൃੜ͢Δલʹ࣮֬ʹϋϯυϥΛ ొ࿥͢ΔͨΊʹɺ7Ͱ+4Λ࣮ߦͨ͠௚ޙʹ QSPDFTTOFYU5JDL ʹొ࿥͞Εͨؔ਺Λશ෦࣮ ߦ͢ΔΑ͏ʹ͍ͨ͠ɻ

  19. ࠷ॳͷ࣮ݧͰ֬ೝ͠·ͨ͠ OPEFW W OPEFBKT CFHJO FOE OPEF XBSOJOH3FDVSTJWFQSPDFTTOFYU5JDLEFUFDUFE5IJTXJMMCSFBLJOUIFOFYUWFSTJPOPGOPEF 1MFBTFVTFTFU*NNFEJBUFGPSSFDVSTJWFEFGFSSBM 

    OPEF XBSOJOH3FDVSTJWFQSPDFTTOFYU5JDLEFUFDUFE5IJTXJMMCSFBLJOUIFOFYUWFSTJPOPGOPEF 1MFBTFVTFTFU*NNFEJBUFGPSSFDVSTJWFEFGFSSBM ! 3BOHF&SSPS.BYJNVNDBMMTUBDLTJ[FFYDFFEFE QSPDFTTOFYU5JDL͕શ෦࣮ߦ͞ΕΔͷͰɺ TFU5JNFPVU͕ಈ͔ͳ͍
  20. OPEFWʹ޲͚ͯJTBBDT͔ΒͷఏҊ w ࠶ؼॲཧͱ͔ͷల։΋ͦ͜Ͱߦ͏ͷͰ࣍ͷΑ͏ ͳίʔυͰ͸TFU5JNFPVU ͸ىಈ͠ͳ͘ͳΔΑɻ TFU5JNFPVU GVODUJPO \ DPOTPMFMPH UJNFPVU

     ^   QSPDFTTOFYU5JDL GVODUJPOG \ QSPDFTTOFYU5JDL G  ^ 
  21. ཧղͰ͖·͔ͨ͠ʁ

  22. OFYU5JDL͸༻๏༻ྔΛकͬͯ ਖ਼͓͘͠࢖͍͍ͩ͘͞ w WҎ߱͸͍͍ͩͨಉ͡ɻ w ίϯςΩετ͕ऴΘ͔ͬͯΒ࣮ߦ͍ͨ͠ॲཧΛOFYU5JDL͔Βݺͼग़͢ɻ͙͢ ׬ྃ͢ΔFNJUͱ͔ɻ w ࠶ؼ͢ΔͳΒTFU*NNFEJBUFͰɻ w

    ඇಉظͬΆ͍ΠϯλϑΣʔεͷಉظॲཧͰOFYU5JDL͢Δͱຊ౰ʹඇಉظʹͳ Δɻ w TFU5JNFPVU GVODUJPO  ʹରͯ͠OFYU5JDL͸ഒ͙Β͍଎͍ɻIUUQT HJTUHJUIVCDPNNNBMFDLJ w /PEFKTJT$BODFSʹର͢ΔOFYU5JDLʹΑΔղˠ'BTUOPOCMPDLJOH pCPOBDDJTFSWFSIUUQTHJUIVCDPNHMFOKBNJOOPEFpC
  23. ͓·͚

  24. W΋͍͍ͩͨಉ͡Ͱ͢ /PEFWͷ৽ػೳʹ͍ͭͯ IUUQXXXTMJEFTIBSFOFUTIJHFLJ@PIUTV OPEFWUOH ϖʔδ໨

  25. WͷΠϕϯτϧʔϓ JOUVW@SVO VW@MPPQ@U MPPQ VW@SVO@NPEFNPEF \ JOUUJNFPVU JOUS ! SVW@@MPPQ@BMJWF

    MPPQ  XIJMF SMPPQTUPQ@qBH \ 67@5*$,@45"35 MPPQ NPEF  ! VW@@VQEBUF@UJNF MPPQ  VW@@SVO@UJNFST MPPQ  VW@@SVO@JEMF MPPQ  VW@@SVO@QSFQBS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