#1293: Array PMC freeze/thaw/visit broken
--------------------+-------------------------------------------------------
 Reporter:  cotto   |       Owner:     
     Type:  bug     |      Status:  new
 Priority:  normal  |   Milestone:     
Component:  none    |     Version:     
 Severity:  medium  |    Keywords:     
     Lang:          |       Patch:     
 Platform:          |  
--------------------+-------------------------------------------------------

Comment(by whiteknight):

 Sparse array algorithms represent a tradeoff: More efficient memory
 storage for arrays that contain mostly default values in exchange for
 more-expensive field access.

 A sparse array is only a benefit in terms of storage space if the
 following conditions are met:
  - The array is very large
  - The majority of items in the array are a default value

 Even when it's a win in terms of storage efficiency, it's still going to
 be more expensive _in all cases_ to access, modify, add, and remove items
 from the array. If the storage is managed aggressively, it may be
 performance neutral (or even a slight improvement in some cases) to do
 copies and comparisons.

 The Array PMC as it is implemented right now uses a linked list of
 List_Chunk objects to implement it's storage. These List_Chunks are GCable
 items, so the number of items in an array translates directly to increased
 GC pressure. This is all not to mention that the Array PMC code is a large
 example of how not to write a PMC following best practices.

 If we are going to add sparse behavior to existing array types, I suggest
 we:
  - Not make sparse behavior the default.
  - Add an "opt-in" ability to specify that an array should be treated as
 sparse (buyer beware)
  - Add an ability to check whether the array is currently in "sparse mode"
 or "normal mode".
  - Add a routine to check whether a given array would benefit from
 sparseness

-- 
Ticket URL: <https://trac.parrot.org/parrot/ticket/1293#comment:3>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets

Reply via email to