Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: [40d] stocks screen is unaccountably slow  (Read 887 times)

numerobis

  • Bay Watcher
    • View Profile
[40d] stocks screen is unaccountably slow
« on: February 09, 2009, 11:19:39 pm »

Counting just a few thousand seeds, stone, wood, or whatever takes a noticeable amount of time when I move the cursor to that category in the stocks screen.  Are you accidentally doing something in quadratic time, like a push_back on an slist or a push_front on a vector?
Logged

Gertack

  • Bay Watcher
    • View Profile
Re: [40d] stocks screen is unaccountably slow
« Reply #1 on: February 09, 2009, 11:45:13 pm »

Probably a linear scan of a linked list in order to build the stacks of items in common. A hash table or sorting the list first would help if that was true.

If I accidentally list the 55,213 stones in my stocks it is time for me to get up, get a drink, use the bathroom, stretch, and maybe it'll be done by the time I get back on my Athlon64 X2 4200.
Logged

numerobis

  • Bay Watcher
    • View Profile
Re: [40d] stocks screen is unaccountably slow
« Reply #2 on: February 10, 2009, 12:49:40 am »

Categorizing shouldn't cost much -- I have 27 categories of stone, and 27 * 10,000 isn't a very big number.
Logged

Footkerchief

  • Bay Watcher
  • The Juffo-Wup is strong in this place.
    • View Profile
Re: [40d] stocks screen is unaccountably slow
« Reply #3 on: February 10, 2009, 07:51:29 am »

It would be really nice if this got fixed.  I have to purposely avoid selecting the Stone category in any reasonably mature fortress, just so the game won't freeze up for 5+ seconds.
Logged

Valandor

  • Bay Watcher
    • View Profile
Re: [40d] stocks screen is unaccountably slow
« Reply #4 on: February 10, 2009, 08:28:44 am »

I think one the main problems with DF atm is efficiency. Toady, great as he is with coming up with stuff, doesn't program efficiently enough to make the game move fluently enough at times.
Logged

Untelligent

  • Bay Watcher
  • I eat flesh!
    • View Profile
Re: [40d] stocks screen is unaccountably slow
« Reply #5 on: February 10, 2009, 05:19:55 pm »

I got used to this a long time ago and now, when I need to look at something below the stone section (usually bars), I automatically move down four single times before I start paging down.
Logged
The World Without Knifebear — A much safer world indeed.
regardless, the slime shooter will be completed, come hell or high water, which are both entirely plausible setbacks at this point.

numerobis

  • Bay Watcher
    • View Profile
Re: [40d] stocks screen is unaccountably slow
« Reply #6 on: February 10, 2009, 06:31:19 pm »

My problem is that my fortress is old, so when I want to look at bars, stone, seeds, logs, or gems, it gets slow.  A couple more goblin attacks and handwear will be slow too.
Logged

Rockphed

  • Bay Watcher
    • View Profile
Re: [40d] stocks screen is unaccountably slow
« Reply #7 on: February 10, 2009, 07:07:10 pm »

I got used to this a long time ago and now, when I need to look at something below the stone section (usually bars), I automatically move down four single times before I start paging down.

I do this too.  Unfortunately, in my most recent fortress, seeds have joined stones in the list of things I have way too many of.
Logged
Only vaguely. Made of the same substance and put to the same use, but a bit like comparing a castle and a doublewide trailer.

The-Moon

  • Bay Watcher
    • View Profile
Re: [40d] stocks screen is unaccountably slow
« Reply #8 on: February 10, 2009, 10:49:27 pm »

Counting just a few thousand seeds, stone, wood, or whatever takes a noticeable amount of time when I move the cursor to that category in the stocks screen.  Are you accidentally doing something in quadratic time, like a push_back on an slist or a push_front on a vector?

Yes it does.

I have a 3ghz Celeron D, with 2gigs of DDR2 ram, and it lags pretty bad at the stock screen, even with a 3x3 map.

It has to go through all the layers of the map, check them all for any objects. At least i assume that's what it does. Otherwise it wouldn't make sense to take as long as it did.

So that can take a while i assume, specially if you have a lot of objects. I'm sure toady will optimize this later on. I doubt this is at the top of his list of things to fix / optimize :D
Logged
There is absolutely no time, to be taking time for granted. ~Busta Rhymes

numerobis

  • Bay Watcher
    • View Profile
Re: [40d] stocks screen is unaccountably slow
« Reply #9 on: February 10, 2009, 10:58:37 pm »

It has to go through all the layers of the map, check them all for any objects. At least i assume that's what it does. Otherwise it wouldn't make sense to take as long as it did.
It doesn't fit the data: it's typically very fast to count up your globs, very slow to count up your stones.
Logged