The Trunk: Morphic-mt.1549.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Morphic-mt.1549.mcz

commits-2
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1549.mcz

==================== Summary ====================

Name: Morphic-mt.1549
Author: mt
Time: 30 September 2019, 11:19:38.88371 am
UUID: 6bbc0287-72da-fe4c-889d-591c9bec9657
Ancestors: Morphic-mt.1548

Caches "fullList" in pluggable lists to speed up list filtering.

Note that we have now two kinds of caches in PluggableListMorph: (1) inst-var access to "list" with invalidation/update via #getList and (2) the accessor #fullList. In the future, we should harmonize that design ... Since the addition of list filters, we forgot to treat inst-var access to "list" as a cache. There are way too many sends of #getFullList at the moment. So that new cache makes sense.

=============== Diff against Morphic-mt.1548 ===============

Item was changed:
  ScrollPane subclass: #PluggableListMorph
+ instanceVariableNames: 'list fullList getListSelector getListSizeSelector getListElementSelector getIndexSelector setIndexSelector keystrokeActionSelector autoDeselect lastKeystrokeTime lastKeystrokes lastClickTime doubleClickSelector handlesBasicKeys potentialDropRow hoverRow listMorph hScrollRangeCache keystrokePreviewSelector priorSelection getIconSelector getHelpSelector'
- instanceVariableNames: 'list getListSelector getListSizeSelector getListElementSelector getIndexSelector setIndexSelector keystrokeActionSelector autoDeselect lastKeystrokeTime lastKeystrokes lastClickTime doubleClickSelector handlesBasicKeys potentialDropRow hoverRow listMorph hScrollRangeCache keystrokePreviewSelector priorSelection getIconSelector getHelpSelector'
  classVariableNames: 'ClearFilterAutomatically FilterableLists HighlightHoveredRow MenuRequestUpdatesSelection'
  poolDictionaries: ''
  category: 'Morphic-Pluggable Widgets'!
 
  !PluggableListMorph commentStamp: 'cmm 8/21/2011 23:37' prior: 0!
  When a PluggableListMorph is in focus, type in a letter (or several letters quickly) to go to the next item that begins with that letter (if FilterableLists is false).
 
  Special keys (up, down, home, etc.) are also supported.!

Item was changed:
  ----- Method: PluggableListMorph>>getFullList (in category 'model access') -----
  getFullList
  "The full, unfiltered list."
+ ^ fullList ifNil: [fullList := model perform: getListSelector]!
- ^ model perform: getListSelector!

Item was changed:
  ----- Method: PluggableListMorph>>updateList (in category 'updating') -----
  updateList
+
  | index |
+ fullList := nil.
- "the list has changed -- update from the model"
  self listMorph listChanged.
- self setScrollDeltas.
  index := self getCurrentSelectionIndex.
  self resetPotentialDropRow.
  self selectionIndex: (self uiIndexFor: index).
  !


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-mt.1549.mcz

timrowledge


> On 2019-09-30, at 2:19 AM, [hidden email] wrote:
>
>
> Caches "fullList" in pluggable lists to speed up list filtering.

Does this interact with LazyList (or whatever its called - not in front of an image I can check) and what happens if the full list is millions of items?

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Strange OpCodes: RBT: Rewind and Break Tape



Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-mt.1549.mcz

marcel.taeumel
Hi Tim,

having no filter, "fullList" is the identical cache as "list" has been for a while now:

PluggableListMorph >> #getList
   ...
   list := self getFullList.
   ...

The "list" cache will be different once you start filtering items:

PluggableListMorph >> #filterList
   ...
   list := newList.
   ...

In the LazyListMorph, there is another cache, which builds up from "list" items that have been drawn at least once:

LazyListMorph >> #item:
   ...
   listItems at: index put: newItem
   ...

That last cache is probably not necessary but I think it is a good idea to keep PluggableListMorph and LazyListMorph decoupled in the sense that they do not rely on each other's caches. At least the reason for caching is different:

- PluggableListMorph caches "list" and (now) "fullList" to speed up filtering
- LazyListMorph caches "listItems" to speed up drawing

Note that cache invalidation happens here:

LazyListMorph >> #listChanged
PluggableListMorph >> #getList (! really tricky !)
PluggableListMorph >> #update: (from changed/update and see #updateList:)

For millions of items, that new cache of "fullList" does not make memory consumption that worse ... maybe a little bit if you start applying a filter. Then, "fullList" and "list" might share a substantial amount of elements. Then again, how expensive is "Array new: 10000000" anyway? The items themselves are not copied.

Best,
Marcel

Am 30.09.2019 19:36:06 schrieb tim Rowledge <[hidden email]>:



> On 2019-09-30, at 2:19 AM, [hidden email] wrote:
>
>
> Caches "fullList" in pluggable lists to speed up list filtering.

Does this interact with LazyList (or whatever its called - not in front of an image I can check) and what happens if the full list is millions of items?

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Strange OpCodes: RBT: Rewind and Break Tape