mehran22000 / aslbekharAndroid

1 stars 0 forks source link

Verified - App first lunch is extremely slow #36

Closed mehran22000 closed 8 years ago

mehran22000 commented 8 years ago

I think we discussed the alternative fixes. please use them. Basically there should not be any delay to get to the city selection screen. no wait for the server till this point. When you click on one city, only fetch the stores for that city not all the stores. Performance is very critical for this app.

aminsepahan commented 8 years ago

you know there is no server transmitting at the start up ! but only processing data !

you know I have to generate cat list and its image for each city ! maybe a solution would be to have this on site ! like brandList, have catList in server that takes city number as a parameter !

I had this problem from the beginning that there shouldn't be any data processing in client side !

mehran22000 commented 8 years ago

Umm processing local data are very fast. in iOS is nearly zero. How do you implement this? Do you parse a JSON text file(?). Do u keep all the cities in a single file? Do you think the slowness is related to images?

aminsepahan commented 8 years ago

well there are 2542 stores in total which will require to be parsed from json only to find the cats, which is another 2500 for loop and for each cat, it has to go through the brandlist to get images and also number of brands for that cat ! so its a pretty heavy processing for startup !

aminsepahan commented 8 years ago

however, I did save the cat List and and it as a asset file ! so now it is really fast, but there will be a problem and that's when we download a refreshed data for a city which will require processing again for cat list ! what we can do is, and I'm begging you, to have another web service url for cat list ! just like city store list and brand list !

aminsepahan commented 8 years ago

the cat list url should return data, like this:

String title;
String cId;
List<String> images;

and the json like this:

[{"cId":"2","images":["avene","galenic","mariloubio","klorane","renefurterer","misseden","comfortzone","phyto","ducray","payot"],"title":"آرایش و زیبایی"},{"cId":"5","images":["tagheuer","orient","certina","police","ingersoll","romanson","casio","esprit","movado","swatch","hamilton","cerruti","omega","tissot","suunto","pierrecardin","rolex","seiko","ck","rado"],"title":"ساعت"},{"cId":"13","images":["midas","gandyjewelry"],"title":"طلا و جواهر"},{"cId":"12","images":["greenapple","zeroten","rolan","avat","sevenpoon"],"title":"لوازم و پوشاک کودک"},{"cId":"10","images":["apple","zte","samsung","acer"],"title":"موبایل"},{"cId":"3","images":["benetton","debenhams","massimodutti","polo","abercrombie","baleno","zara","giordano","samuelandkevin","hangten","bershka","adolfodominguez","diesel","handm","asteen","koton","versace","salian","promod","jeanswest","tommy","cat"],"title":"پوشاک"},{"cId":"7","images":["maxim","ecut","giovanegentile","hacoupian","gerad","lrc","jamee","firs","lcman"],"title":"پوشاک آقایان"},{"cId":"6","images":["defacto","misssport","lefon","adl","tt","joymiss","rengin","mango","dayi"],"title":"پوشاک بانوان"},{"cId":"1","images":["salomon","361","adidas","nike","wilson","puma","reebok","lining","peak"],"title":"پوشاک ورزشی"},{"cId":"9","images":["novincharm","pandora","whitebuffalo","dorsa","maral-leather","mashadleather","blackbuffalo","novincharm"],"title":"چرم"},{"cId":"4","images":["shifer","geox","beheshtian","ecco","daniellee","clarks","skechers"],"title":"کفش"}]

aminsepahan commented 8 years ago

where images is basically string list of brand logos

mehran22000 commented 8 years ago

Thanks Amin Ideally we want to make iOS and Android app consistent. iOS is really fast using the same service. Let us review how do you implement it. If it is needed I will add a new service. 1) You receive a json with 2542 stores, this is the first problem. You should call the service for each city separately (look at issue #3). we will support 50+ cities in a year so the list will be huge and there is no need to fetch all the data for cities that the user does not care.

mehran22000 commented 8 years ago

2) When you fetch data for the city, you should parse it into a dictionary (key = category) and (value=brand). 3) For the category screen, for each category find max of 9 logos which you store them locally. so it will be super fast.

aminsepahan commented 8 years ago

well you know we have to go through all the stores to get the cats, and you know we have to go through all the brands for each cat to get the 8 images, and count all the brands for the number ! do you want me to paste my code here ?!

mehran22000 commented 8 years ago

Is this still an issue? Can you confirm you fetch and parse stores only for the cities user selected. I mean you do not parse all the stores for all the cities together?

aminsepahan commented 8 years ago

no it's not an issue anymore :)