Loops while inspecting data structures (Re: Pharo 4.0 -- Inspecting a recursive data structure is slow)

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

Loops while inspecting data structures (Re: Pharo 4.0 -- Inspecting a recursive data structure is slow)

Hannes Hirzel
On 8/30/15, Nicolai Hess <[hidden email]> wrote:

> No this doesn't even fully work for the GTInspector (even not in Pharo
> 5.0).
>
> It is the same issue Ben discovered when working with the pointer explorer.
> (http://forum.world.st/Proposal-for-LiteralArray-class-tp4803015.html
> and
> http://forum.world.st/Fwd-14827-ProtoObject-pointersTo-failing-circular-references-tp4802576.html
> )
>
> The problem is that arrays printOn:
> does not check for already visited objects
> (squeak does this, but the implementation in pharo changed).
>
> For example, in Pharo 50
>
> | myDict |
> myDict := Dictionary new.
> myDict at: #hello put: 'hello'.
> myDict at: #recurHello put: myDict.
> myDict inspect
>
> you can open the inspector, but selecting the first element in the "keys"
> tab makes the image
> unresponsive. The same happens if you select the #array instvar in the
> "raw" tab.
>
>
>
> 2015-08-29 15:16 GMT+02:00 H. Hirzel <[hidden email]>:
>
>> As for me no need to hurry. I switch now to Pharo 5 build 50287 in the
>> meantime. I will continue using that if I do not  run into larger
>> problems.
>>
>> --Hannes
>>
>> On 8/29/15, Marcus Denker <[hidden email]> wrote:
>> >
>> >> On 29 Aug 2015, at 12:58, Andrei Chis <[hidden email]>
>> wrote:
>> >>
>> >> Was there an issue/fix for this in Pharo 5?
>> >> It might be worth backporting to Pharo 4.
>> >>
>> > Maybe one related to what is printed for the dictionary.
>> > It used to be very slow for large collections
>> >
>> >
>> https://pharo.fogbugz.com/f/cases/15311/The-display-string-for-collection-makes-it-difficult-to-inspect

Below is a more illustrative and realistic example.

The loop is indirect.

Result:
a) Pharo 4.0 image freezes
b) Pharo 5-50287 it is fine (see screen shot)

--Hannes


| dict theEntry1 theEntry2 |

dict := Dictionary new.


theEntry1 := Dictionary new.

dict at: 'house' put: theEntry1.

theEntry1 at: 'fr' put: 'maison'.
theEntry1 at: 'ge' put: 'Haus'.
theEntry1 at: 'es' put: 'casa'.
theEntry1 at: 'cf' put: 'building'.



theEntry2 := Dictionary new.

dict at: 'building' put: theEntry2.

theEntry2 at: 'fr' put: 'bâtiment'.
theEntry2 at: 'de' put: 'Gebäude'.
theEntry2 at: 'es' put: 'edificio'.

"cross references"
theEntry2 at: 'cf' put: theEntry1.
theEntry1 at: 'cf' put: theEntry2.

dict inspect

Pharo-50287_recursive_data_structure_Screenshot from 2015-09-02 09:28:51.png (164K) Download Attachment