SlamWhale icon indicating copy to clipboard operation
SlamWhale copied to clipboard

Poetry takes forever to load!

Open exchgr opened this issue 13 years ago • 4 comments

This is probably because the Twitter API calls are all originating from one place: the server. Twitter API calls (and likely the entire PHP REST/JSON API part of this project) needs to be moved to client-side Javascript code to distribute both the load and the Twitter API quota. As well, this will make debugging much easier, as we'll be able to pinpoint exactly where the latency lies in Google Chrome's debugging environment.

exchgr avatar Sep 20 '11 01:09 exchgr

I will code a Javascript function that uses AJAX to query the Twitter API. I may or may not mirror the Line object from rhyme.php.

exchgr avatar Sep 20 '11 02:09 exchgr

Perhaps we could have the client get a list of rhyming words from us (strip out all the unnecessary info from rhymebrain's API JSON and return a 1 dimensional array in JSON), then make a few of the Twitter API calls at a time, and send all the stripped-down tweet data back to us for processing (Tweet text and their associated Tweet ID) and then get just the IDs of rhymed tweets from us. If it's not enough to fill the poem, then continue with the pattern. Then it would display only the tweets with matching IDs, and discard the rest for memory purposes. I can flesh out this design later.

exchgr avatar Sep 20 '11 04:09 exchgr

Someone had said that it would be a good idea to cache a large amount of data from the Twitter Streaming API, and then make queries to our local cache, instead of making hundreds of queries to the Twitter API. I think that's a wonderful idea, but we have a lot to learn in order to get that done right.

exchgr avatar Sep 20 '11 15:09 exchgr

It's actually even slower now. :(

Keeping this open.

bilalq avatar Mar 15 '14 07:03 bilalq