On Dec 9, 2010, at 16:25 , Martin Dias wrote:
> Hi all,
>
> Thank you for the discussion, is very interesting for me.
>
> Thanks Adrian, I don't have benchmarks with ImageSegment, so I like to
> see the numbers, how could I reproduce that benchmarks? it would be
> useful for me.
This is the essential part of our code (in a subclass of ImageSegment) that
writes out our model starting from the root anObject
basicSave: anObject
| stream temp symbolHolder |
symbolHolder := Symbol allSymbols.
self
copyFromRoots: (Array with: anObject)
sizeHint: self fileSize // 2
areUnique: true.
state = #activeCopy
ifFalse: [ ^ self logger error: 'wrong serializer state' ].
temp := endMarker.
endMarker := nil.
stream := FileStream forceNewFileNamed: fileName.
[ stream fileOutClass: nil andObject: self ]
ensure: [ stream close ].
endMarker := temp.
Loading is done as follows:
| stream streamContents mode object |
stream := aDirectory oldFileOrNoneNamed: filename.
streamContents := stream fileInObjectAndCode.
^ streamContents install
I just timed how long it takes to run these method.
HTH,
Adrian