There may be merit in holding onto the results from
TArea::koordinatesystem() within the in-memory TArea - I experimented
with this and swapping the z and x coordinates (so the z one was the
outermost one) - although it made room movement more complex (especially
if the z coordinate was changed) I think it will also speed up both 2D
and 3D map drawing because instead of scanning though the entire area's
room list once for each ebenen (level or z axis values) to find the
rooms on THAT (z) level we could iterate through each level at a time
and place the rooms on that value very quickly; obviously this would
make the getRoomsByPosition() and getCollisionNodes() trivially easy and
fast at the expense of an additional QMap<int{z}, QMap<int{y}
QMultiMap<int{x}, int{roomId}> > > for each TArea class instance...

BTW I recently stumbled across the QSet construct and for some
operations involving a collection (or more properly two such
collections) of room or area Ids it may offer some advantageous
operations (intersect & subtract) over QList if we don't need to process
it's member in sequence.

On 06/01/2014 22:22, Vadim Peretokin wrote:
> Public bug reported:
> 
> It loops through all rooms in an area and is really slow. In a script
> that was autolinking exits, replacing a getRoomsByPosition() call with a
> Lua table lookup decreased the time to process 50 rooms from 9.7s down
> to 0.001s.
> 
> ** Affects: mudlet
>      Importance: Undecided
>          Status: New
>

-- 
You received this bug notification because you are a member of Mudlet
Makers, which is subscribed to Mudlet.
https://bugs.launchpad.net/bugs/1266573

Title:
  getRoomsByPosition() has poor performance

Status in Mudlet the MUD client:
  New

Bug description:
  It loops through all rooms in an area and is really slow. In a script
  that was autolinking exits, replacing a getRoomsByPosition() call with
  a Lua table lookup decreased the time to process 50 rooms from 9.7s
  down to 0.001s.

To manage notifications about this bug go to:
https://bugs.launchpad.net/mudlet/+bug/1266573/+subscriptions

_______________________________________________
Mailing list: https://launchpad.net/~mudlet-makers
Post to     : mudlet-makers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mudlet-makers
More help   : https://help.launchpad.net/ListHelp

Reply via email to