So one of the problems I have been having with my programs is the length of time it takes to print out a pixel map into the XPM file.
I tested it with like :
500 rows and 2 columns -- 1 second
500 rows and 10 columns -- a few seconds
500 rows and 200 columns -- about 20 seconds
When I try and output the full 500x500 grid after about 4 minutes it's still not done.
Here is the only method I have been using to do this, maybe there is a more efficient way of doing it that I don't know about?
public void addRowsToGrid()
{
String allRows = "";
for(int i = 0;i < 500; i++) {
allRows += "\"";
for(int j = 0;j < 500; j++) {
allRows += grid[i][j].getColor();
}
if (i != 499) {allRows += "\",\n";}
else if (i == 499) {allRows += "\"\n";}
}
allRows += "};\n";
XPM += allRows;
}
Can I get some feedback?