Best way to read an CSV string ? (Performance)

  • 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!

  • 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.

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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!

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)