Best way to read an CSV string ? (Performance)

Discussion and feedback on Construct 2

Post » Tue Jan 28, 2014 2:32 am

Hi,

I am currently using tokenat() with array position to get each values of a CSV string.. however i feel like its really slow. Is there a better way to read such string so it could be super fast ?

Thanks!
B
16
S
5
G
1
Posts: 190
Reputation: 2,489

Post » Tue Jan 28, 2014 3:13 am

It all depends on how often you need to access the CSV string. If it's a once shot here and there. Then just stick with Tokenat. If you need to itterate through the string in say a loop; and it's descent size string. Then you better off probably just converting the csv into an array.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,018

Post » Tue Jan 28, 2014 4:48 am

WEll i am trying to parse the CSV data of a .tmx file (Tiled) it is basically one full row of a very big lenght (2,073,600 x2 entries for a dual layer level of 1920x1080) it actually take 6 seconds and i was trying to reduce that load time.
B
16
S
5
G
1
Posts: 190
Reputation: 2,489

Post » Wed Jan 29, 2014 1:01 am

Nevermind, i developped an algorithm to increase the performance of the read of my CSV data to about 90%! It now take 1 sec to load instead of 5-6. I avoided the use of tokenat for this operation, it was the bottleneck. I used a While with a virtual cursor and find to go through the data which was way more faster!

Thanks for the help through!
B
16
S
5
G
1
Posts: 190
Reputation: 2,489

Post » Tue Feb 11, 2014 9:15 am

HI. I'm trying to sort through my CSV data too. What is this "While with a virtual cursor" magic you speak of, and how can I use it? Can you elaborate please.
B
6
Posts: 10
Reputation: 295


Return to Construct 2 General

Who is online

Users browsing this forum: A2D, paxto22, Refeuh and 1 guest