Perfomance Restkit with AFNetworking



  • I mounted a restserver using the Slim Framework (PHP), connecting in a MySQL BD. It is on a dedicated server and with moderate performance, i.e. the response is very fast.

    But I did a test app in IOS where I consult this api and put together a table view with the result. In the wifi goes fast, but in the "3g" it takes 15 to 30 seconds to load!

    I'm using Restkit with AFNetworking. The api link is: http://api.guia-se.com.br/rafael/ (You can access the result/speed) Is it normal to take all this time to mount UITableView in a small json of these?

    Does anyone know how I could fix that?



  • Everything indicates that it is a network problem but even for a 3G connection, it is a long time to get data.

    I made a very simple benchmark, the minimum time for your service to respond was 511ms and the largest 2.11secs, that is, so everything within normal.

    Maybe it's a problem with your data network, which has nothing to do with AFNetworking or ResKit.

    UPDATEThe hypostesis raised on the table is being updated outside the main thread makes sense.

    First of all, to be sure, place a breakpoint at the point where your table updates and runs in debug mode, when the application stops at breakpoint, make sure the stack is inside the main thread, see in the example below how it should appear.

    Exemplo main thread

    If you are not standing on the main thread, use the solution below to run the call that makes your table update.

    dispatch_async(dispatch_get_main_queue(), ^{
      // execute aqui a chamada que faz sua tabela atualizar
    });
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2