Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [T2 Android] Get next file loop slowness

Author
Message
The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 5th Mar 2014 19:10 Edited at: 5th Mar 2014 19:17
I have started working on a new project where im loading data from textfiles which is used to create the gameworld but I noticed a very strange slowdown. At one point in the loading, im searching a directory for all the the files in that directory and that process is incredibly slow on both my phone and tablet.

This is the code im using to find all the files:


Executing that code once takes about 0.24 seconds on my tablet and 0.05 seconds on my phone. It's acceptable on the phone but 0.24 seconds seems way to high. Loading all the data in the text files (about 30 lines) takes 0.01 seconds on the tablet and 0.001 seconds on the phone.

I have not tested it on any other platforms since im running linux right now...

Are there any faster ways of doing this, or any way to fix the current slowness?

Say ONE stupid thing and it ends up as a forum signature forever. - Neuro Fuzzy
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 5th Mar 2014 19:46
what time it needs without segNames.push_back(file); ?
len>0 of string is faster than string compare with "" too.

AGK 108 (B)19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 5th Mar 2014 19:54
Size>0 is a good idea, i'll have to start using that in the future

Removing .push_back changed nothing and after some more "research" I noticed that it's the getFirstFile() function that takes all the time. The whole while loop only takes 1.6*10[sup]-5[sub] seconds while the firstFile function takes 0.25

Say ONE stupid thing and it ends up as a forum signature forever. - Neuro Fuzzy
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 5th Mar 2014 20:01 Edited at: 5th Mar 2014 20:06
hmm 0.25 is very long, did u have/use anti virus app at your tablet?
its also a long time after restart your tablet?
i believe your tablet have no harddisc.

AGK 108 (B)19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 5th Mar 2014 20:43
Nope, im not using any antivirus and I have tried restarting it, and it's not a HDD either.

I have found a way to work around the issue, but it would still be interesting to know what's causing it

Say ONE stupid thing and it ends up as a forum signature forever. - Neuro Fuzzy
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 5th Mar 2014 22:30
hmm ok, maybe add it to the issue list:
http://code.google.com/p/agk/issues/list

AGK 108 (B)19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 5th Mar 2014 22:42
Good idea, the issue has been added

Say ONE stupid thing and it ends up as a forum signature forever. - Neuro Fuzzy

Login to post a reply

Server time is: 2024-11-25 03:40:27
Your offset time is: 2024-11-25 03:40:27