How Go cache tests

How Go cache tests

A presentation at Go 1.10 Release Party.

5bfed9aa3a9ebccb0c0f0cb65ee9e012?s=128

Seiji Takahashi

February 20, 2018
Tweet

Transcript

  1. )PX(P$BDIF5FTUT (P3FMFBTF1BSUZJO5PLZP (VOPTZ*OD #VTJOFTT%FWFMPQNFOU5FBN 4PGUXBSF&OHJOFFS 4FJKJ5BLBIBTIJ !@@UJNBLJO@@

  2. Seiji Takahashi @__timakin__ • Career • DeNA • Platform Development

    • Serverside Engineering (Perl)
 • Translimit • Game Development: Craft Warrirors • Game Client Side (Cocos-2dx, C++)
 • Gunosy • Application Dev: LUCRA • Serverside Engineering (Go) • iOS Client Side (Swift) • Engieering • Language: Go (Contributed), Swift • Platform: GAE, AWS
  3. None
  4. "HFOEB w 8IBUJTUFTUDBDIJOH  w .ZpSTUDPOUBDUXJUIUIJTGFBUVSF w *NQMFNFOUBUJPO

  5. "HFOEB w 8IBUJTUFTUDBDIJOH  w .ZpSTUDPOUBDUXJUIUIJTGFBUVSF w *NQMFNFOUBUJPO

  6. 8IBUJTUFTUDBDIJOH if the test executable and 
 command line match

    a previous run and 
 the files and environment variables consulted by that run have not changed either, go test will print the previous test output, replacing the elapsed time with the string “(cached).”
  7. 8IBUJTUFTUDBDIJOH 5IFqBHTFYFDVUBCMFXJUIBDBDIFPQUJPO • -cpu • -list • -parallel • -run

    • -short • -v
  8. 8IBUJTUFTUDBDIJOH 5IFqBHUPJHOPSFDBDIJOH • -count=1 %FMFUFDBDIFEIJTUPSZXJUIAHPDMFBOA • go clean -testcache

  9. 8IBUJTUFTUDBDIJOH Benchmarking, and cpu/mem profiling might slightly change from run

    to run. So they aren’t cached. /PODBDIFBCMF TUBUFGVM PQUJPOT
  10. None
  11. None
  12. None
  13. None
  14. "HFOEB w 8IBUJTUFTUDBDIJOH  w .ZpSTUDPOUBDUXJUIUIJTGFBUVSF w *NQMFNFOUBUJPO

  15. .ZpSTUDPOUBDUXJUIUIJTGFBUVSF  DNEHPDPWFSBHFQSPpMFTIPVMECFDBDIFE XJUIUFTUT

  16. None
  17. None
  18. None
  19. None
  20. In the process of code-reading and implementing, code is often

    written near an original caching execution. By chance I’ve read that code before I actually use the caching strategy. DBDIFBCMFDPWFSQSPpMF .ZpSTUDPOUBDUXJUIUIJTGFBUVSF
  21. "HFOEB w 8IBUJTUFTUDBDIJOH  w .ZpSTUDPOUBDUXJUIUIJTGFBUVSF w *NQMFNFOUBUJPO

  22. *NQMFNFOUBUJPO 3FHJTUFSUFTUDPNNBOE

  23. *NQMFNFOUBUJPO $PNNBOE*OJUJBMJ[BUJPO

  24. *NQMFNFOUBUJPO 4FUVQDBDIFPQUJPOGPSCVJMEJOHBQBDLBHF

  25. *NQMFNFOUBUJPO $IFDLBOFYJTUFODFPGDBDIFBSUJGBDUT

  26. *NQMFNFOUBUJPO 1BSTFDBDIFFYQJSBUJPOUJNF SVO5FTU

  27. *NQMFNFOUBUJPO (FUUIFEFGBVMUEJSQBUIPGDBDIFBSUJGBDUT

  28. *NQMFNFOUBUJPO

  29. *NQMFNFOUBUJPO 5SZJOHUPVTFDBDIF

  30. *NQMFNFOUBUJPO $IFDLXIFUIFSUIFPQUJPOTBSFDBDIFBCMF

  31. *NQMFNFOUBUJPO -PBECZUFBSSBZTPGCVJMUUFTUBSUJGBDUT  BOEWBMJEBUFUIFFYQJSBUJPOUJNF

  32. *NQMFNFOUBUJPO 8SJUFUIFl DBDIFE zTUEPVUJOUPUIFCVGGFS

  33. *NQMFNFOUBUJPO AHPDMFBOUFTUDBDIFA

  34. -FU`TDBDIF w "MMPGTUBUFMFTTUFTUTXPVMECFDBDIFEBOE IJHIQFSGPSNBODF w (PDBDIFEFQFOETPOCJOBSZDBDIFBOE
 SFDPSEPGUIFFYQJSBUJPOUJNF w *UJTKVTUBOFXGFBUVSFTPMFU`TDPOUSJCVUFUP (P