BigData - Problems and Their Solutions Problem: LiveCode hangs. It takes too long. It is too slow. As any gamer knows, screen updates are very, very slow. The computer has to do many calculations just to put a pixel on the screen. There are calculations for the location (in the coordinate system), calculations to handle the color, the resolution, the pixel density, and more. As an example, consider a 2 Megapixel graphic. To move that graphic 1 pixel, all of those calculations have to be done on-screen and take time. 2 million calculations takes time, especially as you do it between monitor screen refreshes. On the other hand, if you do the calculations off screen then just place the graphic where it should be - that is fast. You never do calculations on screen, You do the calculations off screen, then update the screen when done. If you have to move someone, you turn off the screen refresh, move the player, then turn screen refresh back on. So if you have too much data in a field on the screen, sorting it in the field on the screen will be very slow and may even crash the program if it runs out of screen storage space. Your options: 1. Lock/unlock the screen. You lock the screen, update it, then unlock the screen e.g. lock screen sort field "mydata" unlock screen 2. Sort in memory, not on the screen Put the data in a variable, work with it, then put the data back on the screen e.g. put field "mydata" into x sort x put x into field "mydata" 3. Work with a subset of data While you are writing code, debugging and testing, do not use all the data. only load some of it e.g. on the "Load Data" button add this code. It will only load 100 lines of data from your file. put 0 into count repeat for each line x in file add one to count if count = 100 then exit repeat put item 1 of x & "," & item 2 of x & "," & item 3 of x after field "mydata" end if |
Big Data >