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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  8. ParseSDK Ͱඇಉظॲཧ
    ParseQuery query = ParseQuery.getQuery(“SomeData”);
    query.findInBackground(new FindCallback() {
    public void done(List result, ParseException e) {
    if (e == null) {
    // Normal
    } else {
    // Error
    }
    }
    });

    View full-size slide

  9. ParseSDK ͷಛ௃
    2. ৼΔ෣͍Λ֦ுͰ͖Δ

    View full-size slide

  10. ParseSDK ͰৼΔ෣͍Λ֦ு
    public class SomeData extends ParseObject {
    @Override
    public void saveInBackground(SaveCallback callback) {
    if (!isValidName()) {
    callback.done(new ParseException());
    }
    super.saveInBackground(callback);
    }
    }

    View full-size slide

  11. ParseSDK ͷಛ௃
    3. Ωϟογϡ΍جຊͷϩδοΫ͸Ӆṭ͞ΕΔ
    SDK ͕Α͠ͳʹ໘౗Λݟͯ͘ΕΔ

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  27. Parse.com
    Client
    Converter
    Loader
    Model
    Request Response
    ParseObject
    Entity
    Model
    Worker Thread
    Main Thread

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide