Performance Mystery Solved - IT'S THE DATA STUPID!!
monte at sweattechnologies.com
Thu Nov 11 19:44:28 CST 2010
> >> Unless you're explicitly purging the stacks, any access to
> >> a property of a stack file will load it into memory. The
> >> first access will take a hit only if the stack isn't already
> >> in memory, but subsequent accesses should be about as fast
> >> whether referring to just the stack name or the stack file
> >> path, since they're interchangeable for mainstacks.
> > I don't think this is entirely true. At least it wasn't when
> > I was working on the standalone builder all those years ago.
> > There was a massive difference in speed between looping over
> > the controls of a stack if that stack was invisible toplevel
> > compared to just referencing it as a filename. There was a
> > user that was having extremely slow builds because they had
> > so many controls.
> It would make me very happy if that were the case.
> A couple years ago there was a long thread here in which I complained that if I access a property in a stack but don't explicitly open the stack, IMO the behavior should be as it was in SuperCard: the stack file is read into memory to obtain the property value, and then the copy in memory is disposed of.
Well even better would be an index at the start of the stack file so the whole file wasn't read into memory, just the prop value. I'd like this to be an option though rather than normal behavior.
> What was happening instead is that the stack file was hanging out in memory just the same as if I had opened it, and many here argued that that was a good thing.
> I haven't tested this myself in a long time - got any current benchmarks?
No, like I said this is just what I remember from when we were in beta with the standalone builder and it was a fair while ago now. It shouldn't be that hard to put together a benchmark test stack though.
> If the behavior has changed then Trevor, Chipp, Jacque, and a good many others who voiced an opinion that leaving it in memory was valuable may not like it, but I'll be quite happy indeed. :)
I never said it wasn't loaded into memory. I know it is and it didn't make sense to me at the time that there would be such a performance difference. Maybe it was something to do with resolving the filename? I'm not sure, I just know it was slower.
More information about the use-livecode