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

ノハナのアプリを爆速で動くようにした話

 ノハナのアプリを爆速で動くようにした話

Keishin Yokomaku

May 15, 2014
Tweet

More Decks by Keishin Yokomaku

Other Decks in Programming

Transcript

  1. ϊϋφͷΞϓϦΛര଎Ͱ ಈ͘Α͏ʹͨ͠࿩ @KeithYokoma

  2. ࣗݾ঺հ @KeithYokoma(ԣນ ܓਅ) 2011೥ גࣜձࣾϛΫγΟೖࣾ ϊϋφͷதͷਓ Android ΞϓϦͷਓ

  3. Available on Kindle Store http://amzn.to/1mZNydv

  4. ࠓ೔ͷ͓࿩ Parse ͱ্खʹ͖ͭ͋͏ ઃܭΛ͍͍ײ͡ʹ͢Δ

  5. ϊϋφͷόοΫΤϯυ Parse.com ParseSDK

  6. ParseSDK ҎԼͷ͜ͱΛͯ͘͠ΕΔ ɾόοΫΤϯυ΁ͷϦΫΤετ ɾऔಘͨ͠σʔλͷ؅ཧ ɾϢʔβΞΧ΢ϯτͷηογϣϯ؅ཧ ɾetc…

  7. ParseSDK ͷಛ௃ 1. ඇಉظॲཧ͕؆୯ʹѻ͑Δ

  8. ParseSDK Ͱඇಉظॲཧ ParseQuery<ParseObject> query = ParseQuery.getQuery(“SomeData”); query.findInBackground(new FindCallback<ParseObject>() { public

    void done(List<ParseObject> result, ParseException e) { if (e == null) { // Normal } else { // Error } } });
  9. ParseSDK ͷಛ௃ 2. ৼΔ෣͍Λ֦ுͰ͖Δ

  10. ParseSDK ͰৼΔ෣͍Λ֦ு public class SomeData extends ParseObject { @Override public

    void saveInBackground(SaveCallback callback) { if (!isValidName()) { callback.done(new ParseException()); } super.saveInBackground(callback); } }
  11. ParseSDK ͷಛ௃ 3. Ωϟογϡ΍جຊͷϩδοΫ͸Ӆṭ͞ΕΔ SDK ͕Α͠ͳʹ໘౗Λݟͯ͘ΕΔ

  12. ؆୯ʂ

  13. 1BSTF0CKFDU 1IPUP#PPL 1IPUP 1BHF ʜ

  14. ڞ௨ͷॲཧ΋͋ΔΑͶʂ

  15. 1BSTF0CKFDU 1IPUP#PPL 1IPUP 1BHF ʜ *NBHF.PEFM .PEFM /FXT ʜ

  16. –ϨϏϡʔ “ڧ੍ऴྃ͢Δ”

  17. –ϨϏϡʔ “࢖͑ͳ͍ɻ ͙͢ڧ੍ऴྃʹͳͬͯຊ౰ʹ࢖͑ͳ͍”

  18. –Crashlytics “New Fatal Issue Discovered in ϊϋφ”

  19. ParseSDK ͷ᠘ 1. ඇಉظॲཧ͕φΠʔϒ ɾϝΠϯεϨουͰ wait ͢Δॴ͕͋Δ ɾContext ͷੜࢮʹؔΘΒͣίʔϧόοΫΛ ݺͿ

  20. ParseSDK ͷ᠘ 2. ϦΫΤετͷϦτϥΠ͕Լख >> java.lang.IllegalStateException: Manager is shut down.

    <<
  21. ParseSDK ͷ᠘ 3. ΦϑϥΠϯͷରԠ͕ࡶ ɾίωΫγϣϯ͕ແ͍ͱΑ͘མͪΔ

  22. ParseSDK ͷ᠘ 4. υΩϡϝϯτʹͳ͍Τϥʔ͕ฦͬͯ͘Δ ɾෛՙ্͕͕ΔͱΑ͘ى͜Δ

  23. ParseSDK ͷ᠘ 5. औ͖ͬͯͨσʔλΛऔΓग़͢ͷ΋࣌ؒ৯͏ ɾParseObject#get**(String) ɾreturn ʹࢸΔ·ͰͷνΣοΫ͕ωοΫ ɾParseObjectͷίϨΫγϣϯ͸͓࡯͠Լ͍͞

  24. ϊϋφͰ ParseSDK ParseObject ͷ֦ுΫϥε܈ ɾϞσϧͷ࢓ࣄ͸શ෦ͦͷதʹ ɾڊେϞσϧʹ੒௕ ɾςετͳ͍ ɾϝϞϦϦʔΫͷڪාʹک͑Δຖ೔

  25. –ඵ଎5Ϋϥογϡ “๻ͨͪͷલʹ͸ ະͩڊେ͗͢ΔϞσϧ͕ ᣔയͱͨ͠ΫϥογϡϨϙʔτ͕ Ͳ͏͠Α͏΋ͳ͘ɺԣͨΘ͍ͬͯͨ”

  26. Ver2.0.0 શମΛϦϑΝΫλϦϯά

  27. ParseSDK ͱ্खʹ෇͖߹͏ ɾͱΓ͋͑ͣ SDK ͷඇಉظॲཧ͸΍ΊΔ ɾͱΓ͋͑ͣ ParseObject ͷ֦ுΛ΍ΊΔ ɾͪΌΜͱϨΠϠΛ෼͚ͯ؅ཧ͢Δ

  28. Parse.com Client Converter Loader Model Request Response ParseObject Entity Model

    Worker Thread Main Thread
  29. ParseSDK ͱ্खʹ෇͖߹͏ UIεϨουͷੈքʹParseObjectΛೖΕͳ͍ ɾLoader ͰੈքΛ̎ͭʹ෼அ ɾόοΫΤϯυͱͷ઀఺ΛClientʹڽू ɾσʔλߏ଄ͱParseObjectΛ෼཭

  30. ݁Ռ ɾڊେϞσϧ͸ډͳ͘ͳͬͨ ɾStop the world ͠ͳ͘ͳͬͨ ɾSDK ͷ᠘ʹΑΔΫϥογϡ͕ݮͬͨ ɾςετ͕ॻ͖΍͘͢ͳͬͨ

  31. ͳΜͱ͔͍ͨ͜͠ͱ ɾParseObject ͔ΒσʔλΛऔΓग़͢ͷॏ͍ ɾREST API ͋ΔͷͰͦΕΛ࢖͍͍ͨ ɾόοΫΤϯυͷ੾Γସ͑Λָʹ͍ͨ͠

  32. ݁࿦ ɾBaaS ͸ָ͍͢͝ ɾόοΫΤϯυ΁ͷΠϯλϑΣʔε͸ͪΌΜ ͱ࡞Βͳ͍ͱ͋ͱͰٽ͘