$30 off During Our Annual Pro Sale. View Details »

DenoでもBunでもいいから 最速を目指す

Yusuke Wada
September 05, 2022

DenoでもBunでもいいから 最速を目指す

Yusuke Wada a.k.a yusukebe
2022/09/05 Node学園 40時限目

Yusuke Wada

September 05, 2022
Tweet

More Decks by Yusuke Wada

Other Decks in Programming

Transcript

  1. %FOPͰ΋#VOͰ΋͍͍͔Β ࠷଎Λ໨ࢦ͢ :VTVLF8BEBBLBZVTVLFCF /PEFֶԂ࣌ݶ໨

  2. ࣗݾ঺հ w :VTVLF8BEBBLBZVTVLFCF w ϘέͯDPGPVOEFS w :"1$"TJBϕεττʔΫ৆ड৆ w גࣜձࣾτϥϕϧϒοΫ 


    εʔύʔόΠβʔ w UXJUUFSDPNZVTVLFCF w HJUIVCDPNZVTVLFCF 
 /PEFֶԂॳࢀՃͰ͢
  3. )POPͱ͍͏ϑϨʔϜϫʔΫΛ͍ͭͬͯ͘·͢ w 8FCϑϨʔϜϫʔΫɾϧʔλʔ w 8FC4UBOEBSE'FUDIͷ"1*ͷΈΛ࢖༻ w ϚϧνϓϥοτϑΥʔϜ w $MPVE fl

    BSF8PSLFSTɺ'BTUMZ$PNQVUF!&EHFɺ%FOPɺ#VO w ϛυϧ΢ΣΞͰػೳ௥Ճ w 5SJF3PVUFS EFGBVMU ͱ3FH&YQ3PVUFSͷͭͷϧʔλʔ͕͋Δ IUUQTIPOPKTEFW
  4. )POPͷͭͷϧʔλʔ w 5SJF3PVUFS w 3FH&YQ3PVUFSCZ!VTVBMPNB w +4ͷ΢ΣϒϑϨʔϜϫʔΫͰߴ଎ͳϧʔλʔΛ࣮૷͢Δํ๏ 4QFBLFS%FDL w IUUQTTQFBLFSEFDLDPNVTVBMPNBVMUSBGBTUKTSPVUFS

  5. 6MUSBGBTU ͱʹ͔͘଎͍ϑϨʔϜϫʔΫΛ໨ࢦ͍ͯ͠Δ

  6. %FOPɺ#VO w #VO w #VOJTBGBTUBMMJOPOF+BWB4DSJQUSVOUJNF 
 IUUQTCVOTI w %FOP w

    0VSHPBMJTUPNBLF%FOPUIFGBTUFTU+BWB4DSJQUSVOUJNF 
 IUUQTEFOPDPNCMPHDIBOHFT )POP͸ͲͪΒͰ΋ಈ͘ͷͰ %FOPͰ΋#VOͰ΋Ͳ͜Ͱಈ͔ͯ͠΋͍͍͔Β Ұ൪଎͍ϑϨʔϜϫʔΫΛ໨ࢦͯ͠ΈΑ͏
  7. 8FCϑϨʔϜϫʔΫ͕଎͍ͱ͸ʁ

  8. ͍͍ͩͨ͜ͷͭΛଌΔ w )FMMP8PSME w ϧʔςΟϯά w 3FRVFTU3FTQPOTFͷॲཧ EFMWFEPSSPVUFSCFODINBSL 4BMUZ"PNCVOIUUQGSBNFXPSLCFODINBSL

  9. طଘϕϯνϚʔΫPSΦϦδφϧ ͰଌͬͯΈΑ͏ .BD#PPL1SP.DPSF(#

  10. %FOPɺ#VOͷલʹ/PEF΋

  11. /PEFϧʔλʔฤ w EFMWFEPSSPVUFSCFODINBSL#FODINBSLPGUIFNPTUDPNNPOMZ VTFEIUUQSPVUFST 
 IUUQTHJUIVCDPNEFMWFEPSSPVUFSCFODINBSL w /PEFͷओཁʮϧʔλʔʯͷϕϯνϚʔΫ w &YQSFTT

    w LPBSPVUFS w LPBUSFFSPVUFS w fi OENZXBZ'BTUJGZͰ࢖ΘΕ͍ͯΔ w USFLSPVUFS w FUD )POPͷݸΛ͋Θͤͯݸͷϧʔλʔ
  12. ΍Γํ ϧʔςΟϯάఆٛ ୟ͖ํ ͋͘·ͰϧʔςΟϯά 
 3FR3FTͷϋϯυϦϯά͸͠ͳ͍

  13. ݁Ռͦͷ Ґ Ґ

  14. ݁Ռ্Ґ Ґ Ґ Ґ

  15. )POP Ґ Ґ ˎͪͳΈʹ)POPͷϧʔλʔ͸ෳ਺ͷϋϯυϥʹରԠͤͨ͞Γ ϓϥΠΦϦςΟ͕ෳࡶͩͬͨΓ͢Δ

  16. ͪͳΈʹ#VOͩͱ

  17. )POP3FH&YQ3PVUFS͕উͭ #VOͷਖ਼نදݱ͕଎͍ /PEFΑΓ஗͘ͳͬͯΔͷ͸ ͳʹ͔ཧ༝͕͋Δͷ͔ͳ͍ͷ͔

  18. ͍Α͍Α%FOP

  19. %FOP)FMMP8PSMEฤ w EFOPTBVSTCFODI📊$PNQBSJOHEFOPOPEF)551 GSBNFXPSLT 
 IUUQTHJUIVCDPNEFOPTBVSTCFODI w %FOPɺ/PEFͷϑϨʔϜϫʔΫΛܭଌ ૉͷ#VO w

    )FMMP8PSMEΛBVUPDBOOPOͰଌΔ w (JU)VC"DUJPOTͰ೔ճɺ݁Ռ͕3&"%.&ʹͳΔ
  20. ݁Ռ ϑϨʔϜϫʔΫͷதͰҰ൪଎͍ #VOׂ͕ͱ஗͍ʁ

  21. +BSSFEొ৔ IUUQTHJUIVCDPNEFOPTBVSTCFODIJTTVFT

  22. BVUPDBOOPO஗͍͔ΒPIB࢖͑ ࠷ۙ͸#PNCBEJFS͕͓ؾʹೖΓΒ͍͠

  23. Ͱɺ࣮͸ʜ

  24. %FOPϕϯνϚʔΫ w ࣮͸)POP͸%FOPެࣜϕϯνϚʔΫͰ࢖ΘΕ͍ͯΔ w IUUQTEFOPMBOECFODINBSLT

  25. None
  26. %FOP fl BTI w %FOPΑΓ࣮ݧతʹಋೖ͞Εͨ)551TFSWFS"1* YJNQSPWFNFOUDPNQBSFEUPPVSFYJTUJOHXFCTFSWFS

  27. w ͔֬ʹ%FOP fl BTI͸#VOΑΓ଎͍ w ͨͩ͠ɺ͜͜Ͱ࢖ΘΕ͍ͯΔ#VOͷ όʔδϣϯ͸ݹ͍ʢ͸ͣʣ

  28. %JWZ͘Μ͕%FOP fl BTIͷϕϯνʹ)POPΛ࢖ͬͯ͘Εͨ HJUIVCDPNEFOPMBOEEFOPQVMM

  29. +BSSFEݱΔ IUUQTHJUIVCDPNEFOPMBOEEFOPQVMMJTTVFDPNNFOU

  30. Ͱ͸#VOฤ΁

  31. #VO)551ϑϨʔϜϫʔΫϕϯν w 4BMUZ"PNCVOIUUQGSBNFXPSLCFODINBSL$PNQBSFUISPVHIQVU CFODINBSLGSPNWBSJPVT#VO)551GSBNFXPSL 
 IUUQTHJUIVCDPN4BMUZ"PNCVOIUUQGSBNFXPSLCFODINBSL

  32. (FU   1BSBNT RVFSZIFBEFS 1PTU+40/

  33. #VO ,JOH8PSME͸΍ͬ Ͱ΋1PTU+40/͸ͦΜͳͰ΋ͳ͍ʁ

  34. 1PTU+40/ w BXBJUBTZODΛ࢖͏ͱ,JOH8PSMEͷύϑΥʔϚϯε΋མͪΔ w (&5  ͳͲ͸ಉظత w )POP͸ ౰࣌

    શͯͷϋϯυϥͰBXBJU͢Δॲཧ͕ೖ͍ͬͯͨ BTZODϋϯυϥͷαϙʔτ BXBJU͢Δॲཧ͕શϋϯυϥʹରͯ͠ߦΘΕ͍ͯͨ 1PTU+40/
  35. BXBJUΛ࢖͏ͱ஗͍໰୊ IUUQTHJUIVCDPNPWFOTICVOJTTVFT

  36. +BSSFEొ৔ IUUQTHJUIVCDPNPWFOTICVOJTTVFTJTTVFDPNNFOU 5IFSFJTTUJMMNPSFXPSLUPCFEPOF UPSFEVDF#VOTQSPNJTFBXBJUPWFSIFBE

  37. WͰվળ ͨͩ͠ ˎ5IFNPSFHFOFSBMDBTFPGBTZODBXBJUQFSGPSNBODFCFJOHXPSTFJO+4$UIBO7JTTUJMMBOJTTVF

  38. #VODBOBSZ ݈ಆͯ͠Δ

  39. +BSSFEͷΞυόΠε ˎW͕ग़ΔલͰ͕͢ʜ

  40. ϋϯυϥ͕Ұͭͷ৔߹͸DPNQPTF͠ͳ͍Α͏ʹͨ͠ IUUQTHJUIVCDPNIPOPKTIPOPQVMM

  41. ABXBJUAΛগͳͨ͘͠ IUUQTHJUIVCDPNIPOPKTIPOPQVMM

  42. #VOWDBOBSZ 
 )POP "dependencies": { "@kapson fi re/bun-bakery": "^0.3.2", "@nbit/bun":

    "^0.7.0", "baojs": "^0.1.3", "bunrest": "^1.1.0", "colstonjs": "latest", "express": "^4.18.1", "hyperbun": "^0.4.6", "kingworld": "^0.0.0-experimental.24" } )POP଎͍ͧ
  43. ࠷৽൛ #VOWDBOBSZ )POPIUUQTHJUIVCDPNIPOPKTIPOPUSFF FCFCDDGEDGCC "dependencies": { "@kapson fi re/bun-bakery": "^0.3.2",

    "express": "^4.18.1", "fastify": "^4.5.3", "hyperbun": "^0.4.6", "kingworld": "^0.0.0-experimental.24" },
  44. ࠷৽ͷ݁Ռ IUUQTHJUIVCDPNZVTVLFCFXFCGSBNFXPSLCFODI

  45. ͱ͍͏͜ͱͰ%FOPͰ΋#VOͰ΋ ϑϨʔϜϫʔΫͷதͰ ˚Ұ൪଎͍ ⦿ҰೋΛ૪͏

  46. ͍ͬͨΜײ૝ w ύϑΥʔϚϯεΛͱΔ͔ϝϯςφϏϦςΟΛͱΔ͔ʁ w 6MUSBGBTUΛΞΠσϯςΟςΟʹͯ͠ΔͷͰͳΔ΂͘଎͘ w ػೳ΋͋ΔͷͰ࠷଎͸େม w ϕϯνϚʔΫ͸ʮͳ·΋ͷʯ w

    ϕϯνϚʔΫ͸೉͍͠ w ؀ڥɺϥϯλΠϜͷ࣮૷ w #VOͷϨεϙϯεϔομʹ͸A%BUFAϔομ͕ͳ͍FUD w ఢΛ࡞ΔՄೳੑ͕͋Δ
  47. %FOP্ͱ#VO্ͳΒͲͪΒ͕଎͍ͷ͔ʁ %FOP fl BTI଎͍ #VO΋৽͍͠)POPͩͱ଎͍

  48. ࡢ೔ڭ͑ͯ΋ΒͬͨϕϯνϚʔΫαΠτ IUUQTEFOPWTCVO fl ZEFW %FOP fl BTI࢖ͬͯͳ͍

  49. #VOͰ͸੩తϑΝΠϧͷαʔϒΛ࠷దԽ͠Α ͏ͱ͍ͯ͠Δ

  50. #VO͸΋ͬͱ଎͘ͳΔ

  51. ͪͳΈʹ%&-&5&͚ͩ3FRVFTUͷத਎ ͕ۭʹͳΔόά͕͋Δ IUUQTHJUIVCDPNPWFOTICVOJTTVFT IUUQTHJUIVCDPNIPOPKTIPOPJTTVFT

  52. %FOP΋

  53. ·ͩ଎͘ͳΔ

  54. 63-͕஗͍໰୊

  55. ΋͏*TTVFʹͳͬͯͨ IUUQTHJUIVCDPNEFOPMBOEEFOPJTTVFT

  56. 63-͡Όͳͯ͘ 63-4FBSDI1BSBNT͚ͩͰΑ͘ͳ͍ʁ

  57. DSFRRVFSZͷߴ଎Խ IUUQTHJUIVCDPNIPOPKTIPOPQVMM

  58. Ҏ্ύϑΥʔϚϯε্͕ͬͨ IUUQTHJTUHJUIVCDPNZVTVLFCFGFEGEFFDEGE

  59. ߴ଎ԽͱϕϯνϚʔΫ͸ ଓ͍͍ͯ͘ʜ