ID:164964
 
Applicable Configuration:
BYOND Version: Newest
Operating System: Vista and XP

Descriptive Problem Summary:
I've been testing a save code created by me and Gshadow8, and it appears that for 2500 turfs, it takes about 6 seconds. or about 400 turfs a second. With 5000 turfs, it takes around 20 seconds, or only 250 a second. With 10000 turfs, it takes around 100 seconds, leaving me with only 100 per second.

1250: 800 a second.
2500: 400 a second.
5000: 250 a second.
10000: 100 a second.

Code Snippet (if applicable) to Reproduce Problem:
proc/SaveMap()
for(var/A=1; A<world.maxz;A+=1)
var/map = "Hoshmap[A].sav"
if(fexists(map)) fdel(map)
var/savefile/F = new(map)
var/list/turfs = list()
for(var/turf/saveable/T in world)
if(T.z == A)
turfs+=T
F["turfs"] << turfs
WorldMsg("The current level [A] has been saved to savefile.")


proc/LoadMap()
for(var/turf/saveable/T in world) del(T)
for(var/A=1; A<world.maxz;A+=1)
var/map = "Hoshmap[A].sav"
if(!fexists(map))
WorldMsg("Failed to load because no map for [A] could be found.")
continue
var/savefile/F = new(map)
var/list/turfs = F["turfs"]
if(!turfs) continue
for(var/turf/saveable/T in turfs) T=locate(T.x, T.y, T.z)
WorldMsg("Saved level [A] has been loaded.")

The lag is from "var/list/turfs = F["turfs"]"

Expected Results:
Linear turfs/time

Actual Results:
exponentially more time per turf.
proc/SaveMap()
for(var/A=1; A<world.maxz;A+=1)
var/map = "Hoshmap[A].sav"
if(fexists(map)) fdel(map)
var/savefile/F = new(map)
var/list/turfs = list()
for(var/turf/saveable/T in world) //This would be your problem.
if(T.z == A)
turfs+=T
F["turfs"] << turfs
WorldMsg("The current level [A] has been saved to savefile.")


You loop through all turfs in the world for every zlevel you have. That would be your problem.
In response to Jp
.... That was not my original question. The problem is in saving not loading. Saving takes about 3 seconds for 12,000 turfs. Loading takes about 100 seconds for 12,000 objects.