[Pharo-project] Howto measure memory footprints of functions/objects/libraries in Pharo?
E.g.: Three different solutions for a Euler problem: (1 to: 999) inject: 0 into: [:sum :i | (i \\ 3 = 0) | (i \\ 5 = 0) ifTrue: [sum + i] ifFalse: [sum]] (1 to: 999) detectSum: [:i | (i \\ 3 = 0) | (i \\ 5 = 0) ifTrue: [i] ifFalse: [0]] (1 to: 999) detectSum: [:i | i * (#(0 0 1 0 1 1 0 0 1 1 0 1 0 0 1) atWrap: i)] How do i measure the exact memory footprint of each solution? Pharo claims having reduced memory footprint at many places. Can that be proofed, e.g. with one comparable demo app, once run in old squeak, once in Pharo 1.1/1.2? And no, MessageTally spyOn: does not do right! Tnx in advance, Guido Stepken
On Tue, 9 Nov 2010, Guido Stepken wrote:
E.g.: Three different solutions for a Euler problem:
(1 to: 999) inject: 0 into: [:sum :i | (i \\ 3 = 0) | (i \\ 5 = 0) ifTrue: [sum + i] ifFalse: [sum]]
(1 to: 999) detectSum: [:i | (i \\ 3 = 0) | (i \\ 5 = 0) ifTrue: [i] ifFalse: [0]]
(1 to: 999) detectSum: [:i | i * (#(0 0 1 0 1 1 0 0 1 1 0 1 0 0 1) atWrap: i)]
How do i measure the exact memory footprint of each solution?
I think you could measure it with the simulator. But these snippets are so simple that they only use at most few kilobytes.
Pharo claims having reduced memory footprint at many places. Can that be proofed, e.g. with one comparable demo app, once run in old squeak, once in Pharo 1.1/1.2?
You misunderstood Pharo's claims. It doesn't mean that running code in Pharo will use less memory than in Squeak. It means that the image is smaller, because it contains less stuff. So, there's nothing to be proven. Btw it's funny that you refer to Squeak as "old".
And no, MessageTally spyOn: does not do right!
MessageTally is for measuring runtime, not space. But I guess the GC statistics are reliable, so the allocated memory and time spent in GC is correct even on CogVM. But your code runs too fast for MessageTally. Levente
Tnx in advance, Guido Stepken
Hi Guido, We wrote a profiler to keep track of memory consumption. http://bergel.eu/download/papers/Berg10g-MemoryProfiling.pdf It will be presented at Smalltalks next week. Cheers, Alexandre On 8 Nov 2010, at 23:47, Guido Stepken wrote:
E.g.: Three different solutions for a Euler problem:
(1 to: 999) inject: 0 into: [:sum :i | (i \\ 3 = 0) | (i \\ 5 = 0) ifTrue: [sum + i] ifFalse: [sum]]
(1 to: 999) detectSum: [:i | (i \\ 3 = 0) | (i \\ 5 = 0) ifTrue: [i] ifFalse: [0]]
(1 to: 999) detectSum: [:i | i * (#(0 0 1 0 1 1 0 0 1 1 0 1 0 0 1) atWrap: i)]
How do i measure the exact memory footprint of each solution?
Pharo claims having reduced memory footprint at many places. Can that be proofed, e.g. with one comparable demo app, once run in old squeak, once in Pharo 1.1/1.2?
And no, MessageTally spyOn: does not do right!
Tnx in advance, Guido Stepken
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Sounds like what I just needed! I'll try it out. Cheers, Max On 09.11.2010, at 12:42, Alexandre Bergel wrote:
Hi Guido,
We wrote a profiler to keep track of memory consumption.
http://bergel.eu/download/papers/Berg10g-MemoryProfiling.pdf
It will be presented at Smalltalks next week.
Cheers, Alexandre
On 8 Nov 2010, at 23:47, Guido Stepken wrote:
E.g.: Three different solutions for a Euler problem:
(1 to: 999) inject: 0 into: [:sum :i | (i \\ 3 = 0) | (i \\ 5 = 0) ifTrue: [sum + i] ifFalse: [sum]]
(1 to: 999) detectSum: [:i | (i \\ 3 = 0) | (i \\ 5 = 0) ifTrue: [i] ifFalse: [0]]
(1 to: 999) detectSum: [:i | i * (#(0 0 1 0 1 1 0 0 1 1 0 1 0 0 1) atWrap: i)]
How do i measure the exact memory footprint of each solution?
Pharo claims having reduced memory footprint at many places. Can that be proofed, e.g. with one comparable demo app, once run in old squeak, once in Pharo 1.1/1.2?
And no, MessageTally spyOn: does not do right!
Tnx in advance, Guido Stepken
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Ok, but please, provide feedback. Alexandre On 9 Nov 2010, at 10:40, Max Leske wrote:
Sounds like what I just needed! I'll try it out.
Cheers, Max
On 09.11.2010, at 12:42, Alexandre Bergel wrote:
Hi Guido,
We wrote a profiler to keep track of memory consumption.
http://bergel.eu/download/papers/Berg10g-MemoryProfiling.pdf
It will be presented at Smalltalks next week.
Cheers, Alexandre
On 8 Nov 2010, at 23:47, Guido Stepken wrote:
E.g.: Three different solutions for a Euler problem:
(1 to: 999) inject: 0 into: [:sum :i | (i \\ 3 = 0) | (i \\ 5 = 0) ifTrue: [sum + i] ifFalse: [sum]]
(1 to: 999) detectSum: [:i | (i \\ 3 = 0) | (i \\ 5 = 0) ifTrue: [i] ifFalse: [0]]
(1 to: 999) detectSum: [:i | i * (#(0 0 1 0 1 1 0 0 1 1 0 1 0 0 1) atWrap: i)]
How do i measure the exact memory footprint of each solution?
Pharo claims having reduced memory footprint at many places. Can that be proofed, e.g. with one comparable demo app, once run in old squeak, once in Pharo 1.1/1.2?
And no, MessageTally spyOn: does not do right!
Tnx in advance, Guido Stepken
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Sure, will do. Max On 09.11.2010, at 15:02, Alexandre Bergel wrote:
Ok, but please, provide feedback.
Alexandre
On 9 Nov 2010, at 10:40, Max Leske wrote:
Sounds like what I just needed! I'll try it out.
Cheers, Max
On 09.11.2010, at 12:42, Alexandre Bergel wrote:
Hi Guido,
We wrote a profiler to keep track of memory consumption.
http://bergel.eu/download/papers/Berg10g-MemoryProfiling.pdf
It will be presented at Smalltalks next week.
Cheers, Alexandre
On 8 Nov 2010, at 23:47, Guido Stepken wrote:
E.g.: Three different solutions for a Euler problem:
(1 to: 999) inject: 0 into: [:sum :i | (i \\ 3 = 0) | (i \\ 5 = 0) ifTrue: [sum + i] ifFalse: [sum]]
(1 to: 999) detectSum: [:i | (i \\ 3 = 0) | (i \\ 5 = 0) ifTrue: [i] ifFalse: [0]]
(1 to: 999) detectSum: [:i | i * (#(0 0 1 0 1 1 0 0 1 1 0 1 0 0 1) atWrap: i)]
How do i measure the exact memory footprint of each solution?
Pharo claims having reduced memory footprint at many places. Can that be proofed, e.g. with one comparable demo app, once run in old squeak, once in Pharo 1.1/1.2?
And no, MessageTally spyOn: does not do right!
Tnx in advance, Guido Stepken
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Um... I should be able to get a visualisation by running somthing like this right (I only installed it, didn't subclass anything)? MemoryProfiler viewProfiling: [ FSDiskFilesystem current working / foo ]. I get a window but there's nothing in it... Also, is selecting the expression in the block above, right clicking and selecting "memory profile it" equivalent to sending #viewProfiling: ? Reading your paper I get the idea that this should work, when looking at the instructions on the moose site it rather seems that I need to subclass MemoryProfiler to actually profile anything. Cheers, Max On 09.11.2010, at 15:02, Alexandre Bergel wrote:
Ok, but please, provide feedback.
Alexandre
On 9 Nov 2010, at 10:40, Max Leske wrote:
Sounds like what I just needed! I'll try it out.
Cheers, Max
On 09.11.2010, at 12:42, Alexandre Bergel wrote:
Hi Guido,
We wrote a profiler to keep track of memory consumption.
http://bergel.eu/download/papers/Berg10g-MemoryProfiling.pdf
It will be presented at Smalltalks next week.
Cheers, Alexandre
On 8 Nov 2010, at 23:47, Guido Stepken wrote:
E.g.: Three different solutions for a Euler problem:
(1 to: 999) inject: 0 into: [:sum :i | (i \\ 3 = 0) | (i \\ 5 = 0) ifTrue: [sum + i] ifFalse: [sum]]
(1 to: 999) detectSum: [:i | (i \\ 3 = 0) | (i \\ 5 = 0) ifTrue: [i] ifFalse: [0]]
(1 to: 999) detectSum: [:i | i * (#(0 0 1 0 1 1 0 0 1 1 0 1 0 0 1) atWrap: i)]
How do i measure the exact memory footprint of each solution?
Pharo claims having reduced memory footprint at many places. Can that be proofed, e.g. with one comparable demo app, once run in old squeak, once in Pharo 1.1/1.2?
And no, MessageTally spyOn: does not do right!
Tnx in advance, Guido Stepken
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Maybe doing a SpaceTally new printSpaceAnalysis and a Smalltalk garbageCollect. before each test....and then compare the different files.. cheers mariano On Tue, Nov 9, 2010 at 12:46 PM, Max Leske <maxleske@gmail.com> wrote:
Um... I should be able to get a visualisation by running somthing like this right (I only installed it, didn't subclass anything)?
MemoryProfiler viewProfiling: [ FSDiskFilesystem current working / foo ].
I get a window but there's nothing in it... Also, is selecting the expression in the block above, right clicking and selecting "memory profile it" equivalent to sending #viewProfiling: ?
Reading your paper I get the idea that this should work, when looking at the instructions on the moose site it rather seems that I need to subclass MemoryProfiler to actually profile anything.
Cheers, Max
On 09.11.2010, at 15:02, Alexandre Bergel wrote:
Ok, but please, provide feedback.
Alexandre
On 9 Nov 2010, at 10:40, Max Leske wrote:
Sounds like what I just needed! I'll try it out.
Cheers, Max
On 09.11.2010, at 12:42, Alexandre Bergel wrote:
Hi Guido,
We wrote a profiler to keep track of memory consumption.
http://bergel.eu/download/papers/Berg10g-MemoryProfiling.pdf
It will be presented at Smalltalks next week.
Cheers, Alexandre
On 8 Nov 2010, at 23:47, Guido Stepken wrote:
E.g.: Three different solutions for a Euler problem:
(1 to: 999) inject: 0 into: [:sum :i | (i \\ 3 = 0) | (i \\ 5 = 0) ifTrue: [sum + i] ifFalse: [sum]]
(1 to: 999) detectSum: [:i | (i \\ 3 = 0) | (i \\ 5 = 0) ifTrue: [i] ifFalse: [0]]
(1 to: 999) detectSum: [:i | i * (#(0 0 1 0 1 1 0 0 1 1 0 1 0 0 1) atWrap: i)]
How do i measure the exact memory footprint of each solution?
Pharo claims having reduced memory footprint at many places. Can that be proofed, e.g. with one comparable demo app, once run in old squeak, once in Pharo 1.1/1.2?
And no, MessageTally spyOn: does not do right!
Tnx in advance, Guido Stepken
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Hi Max,
Um... I should be able to get a visualisation by running somthing like this right (I only installed it, didn't subclass anything)?
MemoryProfiler viewProfiling: [ FSDiskFilesystem current working / foo ].
I get a window but there's nothing in it...
The piece of code you want to profile needs is executed twice, and it needs "to be time consuming" (~ 1 second). For example, try: MemoryProfiler viewProfiling: [ | view | view := MOViewRenderer new. view nodes: (1 to: 5000). view root applyLayout ] or MemoryProfiler viewProfiling: [ (1 to: 2) collect: [ :i | ConfigurationOfMetacello project currentVersion ] ] to get a nice picture
Also, is selecting the expression in the block above, right clicking and selecting "memory profile it" equivalent to sending #viewProfiling: ?
yes
Reading your paper I get the idea that this should work, when looking at the instructions on the moose site it rather seems that I need to subclass MemoryProfiler to actually profile anything.
No need to subclass. Cheers, Alexandre
On 09.11.2010, at 15:02, Alexandre Bergel wrote:
Ok, but please, provide feedback.
Alexandre
On 9 Nov 2010, at 10:40, Max Leske wrote:
Sounds like what I just needed! I'll try it out.
Cheers, Max
On 09.11.2010, at 12:42, Alexandre Bergel wrote:
Hi Guido,
We wrote a profiler to keep track of memory consumption.
http://bergel.eu/download/papers/Berg10g-MemoryProfiling.pdf
It will be presented at Smalltalks next week.
Cheers, Alexandre
On 8 Nov 2010, at 23:47, Guido Stepken wrote:
E.g.: Three different solutions for a Euler problem:
(1 to: 999) inject: 0 into: [:sum :i | (i \\ 3 = 0) | (i \\ 5 = 0) ifTrue: [sum + i] ifFalse: [sum]]
(1 to: 999) detectSum: [:i | (i \\ 3 = 0) | (i \\ 5 = 0) ifTrue: [i] ifFalse: [0]]
(1 to: 999) detectSum: [:i | i * (#(0 0 1 0 1 1 0 0 1 1 0 1 0 0 1) atWrap: i)]
How do i measure the exact memory footprint of each solution?
Pharo claims having reduced memory footprint at many places. Can that be proofed, e.g. with one comparable demo app, once run in old squeak, once in Pharo 1.1/1.2?
And no, MessageTally spyOn: does not do right!
Tnx in advance, Guido Stepken
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Thanks Alexandre. Now I tried out your example and they worked perfectly. I have run into two problem though which I don't know how to deal with: 1. When I run anything else than what you suggested, I do get the window for the profiling view but it is empty. E.g when I run this: MemoryProfiler viewProfiling: [ 1 to: 100000 do: [ :i | (FSMemoryFilesystem new root / ('foo', i asString)) writeStreamDo: [ :stream | stream nextPutAll: 'foo' ] ] ] 2. When I run the code I am actually interested I get a low space warning. Example: repo := FSGitRepository on: FSMemoryFilesystem new root / 'foo' MemoryProfiler viewProfiling: [ repo head ] I'll be happy to run any tests you suggest. If you'd like to run the code yourself, get the packages from Gofer: Gofer new squeaksource: 'GitFS'; package: 'FS-Git'; package: 'Filesystem'; load. Cheers, Max On 09.11.2010, at 22:42, Alexandre Bergel wrote:
Hi Max,
Um... I should be able to get a visualisation by running somthing like this right (I only installed it, didn't subclass anything)?
MemoryProfiler viewProfiling: [ FSDiskFilesystem current working / foo ].
I get a window but there's nothing in it...
The piece of code you want to profile needs is executed twice, and it needs "to be time consuming" (~ 1 second). For example, try:
MemoryProfiler viewProfiling: [ | view |
view := MOViewRenderer new. view nodes: (1 to: 5000). view root applyLayout ]
or
MemoryProfiler viewProfiling: [ (1 to: 2) collect: [ :i | ConfigurationOfMetacello project currentVersion ] ]
to get a nice picture
Also, is selecting the expression in the block above, right clicking and selecting "memory profile it" equivalent to sending #viewProfiling: ?
yes
Reading your paper I get the idea that this should work, when looking at the instructions on the moose site it rather seems that I need to subclass MemoryProfiler to actually profile anything.
No need to subclass.
Cheers, Alexandre
On 09.11.2010, at 15:02, Alexandre Bergel wrote:
Ok, but please, provide feedback.
Alexandre
On 9 Nov 2010, at 10:40, Max Leske wrote:
Sounds like what I just needed! I'll try it out.
Cheers, Max
On 09.11.2010, at 12:42, Alexandre Bergel wrote:
Hi Guido,
We wrote a profiler to keep track of memory consumption.
http://bergel.eu/download/papers/Berg10g-MemoryProfiling.pdf
It will be presented at Smalltalks next week.
Cheers, Alexandre
On 8 Nov 2010, at 23:47, Guido Stepken wrote:
E.g.: Three different solutions for a Euler problem:
(1 to: 999) inject: 0 into: [:sum :i | (i \\ 3 = 0) | (i \\ 5 = 0) ifTrue: [sum + i] ifFalse: [sum]]
(1 to: 999) detectSum: [:i | (i \\ 3 = 0) | (i \\ 5 = 0) ifTrue: [i] ifFalse: [0]]
(1 to: 999) detectSum: [:i | i * (#(0 0 1 0 1 1 0 0 1 1 0 1 0 0 1) atWrap: i)]
How do i measure the exact memory footprint of each solution?
Pharo claims having reduced memory footprint at many places. Can that be proofed, e.g. with one comparable demo app, once run in old squeak, once in Pharo 1.1/1.2?
And no, MessageTally spyOn: does not do right!
Tnx in advance, Guido Stepken
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Hi again. Please ignore the last e-mail for the moment. There's something weird going on in my image. I'll run some tests on a fresh official image first and then post back. Max --------------------------------- Thanks Alexandre. Now I tried out your example and they worked perfectly. I have run into two problem though which I don't know how to deal with: 1. When I run anything else than what you suggested, I do get the window for the profiling view but it is empty. E.g when I run this: MemoryProfiler viewProfiling: [ 1 to: 100000 do: [ :i | (FSMemoryFilesystem new root / ('foo', i asString)) writeStreamDo: [ :stream | stream nextPutAll: 'foo' ] ] ] 2. When I run the code I am actually interested I get a low space warning. Example: repo := FSGitRepository on: FSMemoryFilesystem new root / 'foo' MemoryProfiler viewProfiling: [ repo head ] I'll be happy to run any tests you suggest. If you'd like to run the code yourself, get the packages from Gofer: Gofer new squeaksource: 'GitFS'; package: 'FS-Git'; package: 'Filesystem'; load. Cheers, Max On 09.11.2010, at 22:42, Alexandre Bergel wrote:
Hi Max,
Um... I should be able to get a visualisation by running somthing like this right (I only installed it, didn't subclass anything)?
MemoryProfiler viewProfiling: [ FSDiskFilesystem current working / foo ].
I get a window but there's nothing in it...
The piece of code you want to profile needs is executed twice, and it needs "to be time consuming" (~ 1 second). For example, try:
MemoryProfiler viewProfiling: [ | view |
view := MOViewRenderer new. view nodes: (1 to: 5000). view root applyLayout ]
or
MemoryProfiler viewProfiling: [ (1 to: 2) collect: [ :i | ConfigurationOfMetacello project currentVersion ] ]
to get a nice picture
Also, is selecting the expression in the block above, right clicking and selecting "memory profile it" equivalent to sending #viewProfiling: ?
yes
Reading your paper I get the idea that this should work, when looking at the instructions on the moose site it rather seems that I need to subclass MemoryProfiler to actually profile anything.
No need to subclass.
Cheers, Alexandre
On 09.11.2010, at 15:02, Alexandre Bergel wrote:
Ok, but please, provide feedback.
Alexandre
On 9 Nov 2010, at 10:40, Max Leske wrote:
Sounds like what I just needed! I'll try it out.
Cheers, Max
On 09.11.2010, at 12:42, Alexandre Bergel wrote:
Hi Guido,
We wrote a profiler to keep track of memory consumption.
http://bergel.eu/download/papers/Berg10g-MemoryProfiling.pdf
It will be presented at Smalltalks next week.
Cheers, Alexandre
On 8 Nov 2010, at 23:47, Guido Stepken wrote:
E.g.: Three different solutions for a Euler problem:
(1 to: 999) inject: 0 into: [:sum :i | (i \\ 3 = 0) | (i \\ 5 = 0) ifTrue: [sum + i] ifFalse: [sum]]
(1 to: 999) detectSum: [:i | (i \\ 3 = 0) | (i \\ 5 = 0) ifTrue: [i] ifFalse: [0]]
(1 to: 999) detectSum: [:i | i * (#(0 0 1 0 1 1 0 0 1 1 0 1 0 0 1) atWrap: i)]
How do i measure the exact memory footprint of each solution?
Pharo claims having reduced memory footprint at many places. Can that be proofed, e.g. with one comparable demo app, once run in old squeak, once in Pharo 1.1/1.2?
And no, MessageTally spyOn: does not do right!
Tnx in advance, Guido Stepken
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Hi Alexandre The weird behaviour seems to be related to inline compilation in workspaces. I moved the execution into a method, now everything's back to normal. In the meantime I verified the previously described scenarios with a fresh one-click image (Pharo 1.1). One really dramatic example is this: repo := FSGitRepository on: FSDiskFilesystem current working / 'foo'. MessageTally spyOn: [ repo tagNames ] ---> 3ms for a huge repository with 10 tags. MemoryProfiler viewProfiling: [ repo tagNames ] ---> low space warning (same repository etc.) I hope you might have an idea what's going wrong. Cheers, Max Hi again. Please ignore the last e-mail for the moment. There's something weird going on in my image. I'll run some tests on a fresh official image first and then post back. Max --------------------------------- Thanks Alexandre. Now I tried out your example and they worked perfectly. I have run into two problem though which I don't know how to deal with: 1. When I run anything else than what you suggested, I do get the window for the profiling view but it is empty. E.g when I run this: MemoryProfiler viewProfiling: [ 1 to: 100000 do: [ :i | (FSMemoryFilesystem new root / ('foo', i asString)) writeStreamDo: [ :stream | stream nextPutAll: 'foo' ] ] ] 2. When I run the code I am actually interested I get a low space warning. Example: repo := FSGitRepository on: FSMemoryFilesystem new root / 'foo' MemoryProfiler viewProfiling: [ repo head ] I'll be happy to run any tests you suggest. If you'd like to run the code yourself, get the packages from Gofer: Gofer new squeaksource: 'GitFS'; package: 'FS-Git'; package: 'Filesystem'; load. Cheers, Max On 09.11.2010, at 22:42, Alexandre Bergel wrote:
Hi Max,
Um... I should be able to get a visualisation by running somthing like this right (I only installed it, didn't subclass anything)?
MemoryProfiler
viewProfiling: [ FSDiskFilesystem current working / foo ].
I get a window but there's nothing in it...
The piece of code you want to profile needs is executed twice, and it needs "to be time consuming" (~ 1 second). For example, try:
MemoryProfiler viewProfiling: [ | view |
view := MOViewRenderer new. view nodes: (1 to: 5000). view root applyLayout ]
or
MemoryProfiler viewProfiling: [ (1 to: 2) collect: [ :i | ConfigurationOfMetacello project currentVersion ] ]
to get a nice picture
Also, is selecting the expression in the block above, right clicking and selecting "memory profile it" equivalent to sending #viewProfiling: ?
yes
Reading your paper I get the idea that this should work, when looking at the instructions on the moose site it rather seems that I need to subclass MemoryProfiler to actually profile anything.
No need to subclass.
Cheers, Alexandre
On 09.11.2010, at 15:02, Alexandre Bergel wrote:
Ok, but please, provide feedback.
Alexandre
On 9 Nov 2010, at 10:40, Max Leske wrote:
Sounds like what I just needed! I'll try it out.
Cheers, Max
On 09.11.2010, at 12:42, Alexandre Bergel wrote:
Hi Guido,
We wrote a profiler to keep track of memory consumption.
http://bergel.eu/download/papers/Berg10g-MemoryProfiling.pdf
It will be presented at Smalltalks next week.
Cheers, Alexandre
On 8 Nov 2010, at 23:47, Guido Stepken wrote:
E.g.: Three different solutions for a Euler problem:
(1 to: 999) inject: 0 into: [:sum :i | (i \\ 3 = 0) | (i \\ 5 = 0)
ifTrue: [sum + i]
ifFalse: [sum]]
(1 to: 999) detectSum: [:i | (i \\ 3 = 0) | (i \\ 5 = 0) ifTrue: [i] ifFalse: [0]]
(1 to: 999) detectSum: [:i | i * (#(0 0 1 0 1 1 0 0 1 1 0 1 0 0 1) atWrap: i)]
How do i measure the exact memory footprint of each solution?
Pharo claims having reduced memory footprint at many places. Can that be proofed, e.g. with one comparable demo app, once run in old squeak, once in Pharo 1.1/1.2?
And no, MessageTally spyOn: does not do right!
Tnx in advance, Guido Stepken
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Ok, I will check. Alexandre On 12 Nov 2010, at 17:40, Max Leske wrote:
Hi Alexandre
The weird behaviour seems to be related to inline compilation in workspaces. I moved the execution into a method, now everything's back to normal.
In the meantime I verified the previously described scenarios with a fresh one-click image (Pharo 1.1). One really dramatic example is this:
repo := FSGitRepository on: FSDiskFilesystem current working / 'foo'. MessageTally spyOn: [ repo tagNames ]
---> 3ms for a huge repository with 10 tags.
MemoryProfiler viewProfiling: [ repo tagNames ]
---> low space warning (same repository etc.)
I hope you might have an idea what's going wrong.
Cheers, Max
Hi again. Please ignore the last e-mail for the moment. There's something weird going on in my image. I'll run some tests on a fresh official image first and then post back. Max
--------------------------------- Thanks Alexandre. Now I tried out your example and they worked perfectly. I have run into two problem though which I don't know how to deal with: 1. When I run anything else than what you suggested, I do get the window for the profiling view but it is empty. E.g when I run this:
MemoryProfiler viewProfiling: [ 1 to: 100000 do: [ :i | (FSMemoryFilesystem new root / ('foo', i asString)) writeStreamDo: [ :stream | stream nextPutAll: 'foo' ] ] ] 2. When I run the code I am actually interested I get a low space warning. Example: repo := FSGitRepository on: FSMemoryFilesystem new root / 'foo' MemoryProfiler viewProfiling: [ repo head ]
I'll be happy to run any tests you suggest. If you'd like to run the code yourself, get the packages from Gofer: Gofer new squeaksource: 'GitFS'; package: 'FS-Git'; package: 'Filesystem'; load. Cheers, Max
On 09.11.2010, at 22:42, Alexandre Bergel wrote:
Hi Max,
Um... I should be able to get a visualisation by running somthing like this right (I only installed it, didn't subclass anything)?
MemoryProfiler
viewProfiling: [ FSDiskFilesystem current working / foo ].
I get a window but there's nothing in it...
The piece of code you want to profile needs is executed twice, and it needs "to be time consuming" (~ 1 second). For example, try:
MemoryProfiler viewProfiling: [ | view |
view := MOViewRenderer new. view nodes: (1 to: 5000). view root applyLayout ]
or
MemoryProfiler viewProfiling: [ (1 to: 2) collect: [ :i | ConfigurationOfMetacello project currentVersion ] ]
to get a nice picture
Also, is selecting the expression in the block above, right clicking and selecting "memory profile it" equivalent to sending #viewProfiling: ?
yes
Reading your paper I get the idea that this should work, when looking at the instructions on the moose site it rather seems that I need to subclass MemoryProfiler to actually profile anything.
No need to subclass.
Cheers, Alexandre
On 09.11.2010, at 15:02, Alexandre Bergel wrote:
Ok, but please, provide feedback.
Alexandre
On 9 Nov 2010, at 10:40, Max Leske wrote:
Sounds like what I just needed! I'll try it out.
Cheers, Max
On 09.11.2010, at 12:42, Alexandre Bergel wrote:
Hi Guido,
We wrote a profiler to keep track of memory consumption.
http://bergel.eu/download/papers/Berg10g-MemoryProfiling.pdf
It will be presented at Smalltalks next week.
Cheers, Alexandre
On 8 Nov 2010, at 23:47, Guido Stepken wrote:
E.g.: Three different solutions for a Euler problem:
(1 to: 999) inject: 0 into: [:sum :i | (i \\ 3 = 0) | (i \\ 5 = 0)
ifTrue: [sum + i]
ifFalse: [sum]]
(1 to: 999) detectSum: [:i | (i \\ 3 = 0) | (i \\ 5 = 0) ifTrue: [i] ifFalse: [0]]
(1 to: 999) detectSum: [:i | i * (#(0 0 1 0 1 1 0 0 1 1 0 1 0 0 1) atWrap: i)]
How do i measure the exact memory footprint of each solution?
Pharo claims having reduced memory footprint at many places. Can that be proofed, e.g. with one comparable demo app, once run in old squeak, once in Pharo 1.1/1.2?
And no, MessageTally spyOn: does not do right!
Tnx in advance, Guido Stepken
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Hi Max, Sorry to have taken some time to reply. You helped us to find a bug. This is now fixed (I never redefine #= that is why I did not see it before). Try the following: repo := FSGitRepository on: FSDiskFilesystem current working / 'foo'. MemoryProfiler viewProfiling: [ repo tagNames ] inPackage: 'FS-Git' And you will immediately spot the methods that consume memory :-) Cheers, Alexandre On 12 Nov 2010, at 17:40, Max Leske wrote:
Hi Alexandre
The weird behaviour seems to be related to inline compilation in workspaces. I moved the execution into a method, now everything's back to normal.
In the meantime I verified the previously described scenarios with a fresh one-click image (Pharo 1.1). One really dramatic example is this:
repo := FSGitRepository on: FSDiskFilesystem current working / 'foo'. MessageTally spyOn: [ repo tagNames ]
---> 3ms for a huge repository with 10 tags.
MemoryProfiler viewProfiling: [ repo tagNames ]
---> low space warning (same repository etc.)
I hope you might have an idea what's going wrong.
Cheers, Max
Hi again. Please ignore the last e-mail for the moment. There's something weird going on in my image. I'll run some tests on a fresh official image first and then post back. Max
--------------------------------- Thanks Alexandre. Now I tried out your example and they worked perfectly. I have run into two problem though which I don't know how to deal with: 1. When I run anything else than what you suggested, I do get the window for the profiling view but it is empty. E.g when I run this:
MemoryProfiler viewProfiling: [ 1 to: 100000 do: [ :i | (FSMemoryFilesystem new root / ('foo', i asString)) writeStreamDo: [ :stream | stream nextPutAll: 'foo' ] ] ] 2. When I run the code I am actually interested I get a low space warning. Example: repo := FSGitRepository on: FSMemoryFilesystem new root / 'foo' MemoryProfiler viewProfiling: [ repo head ]
I'll be happy to run any tests you suggest. If you'd like to run the code yourself, get the packages from Gofer: Gofer new squeaksource: 'GitFS'; package: 'FS-Git'; package: 'Filesystem'; load. Cheers, Max
On 09.11.2010, at 22:42, Alexandre Bergel wrote:
Hi Max,
Um... I should be able to get a visualisation by running somthing like this right (I only installed it, didn't subclass anything)?
MemoryProfiler
viewProfiling: [ FSDiskFilesystem current working / foo ].
I get a window but there's nothing in it...
The piece of code you want to profile needs is executed twice, and it needs "to be time consuming" (~ 1 second). For example, try:
MemoryProfiler viewProfiling: [ | view |
view := MOViewRenderer new. view nodes: (1 to: 5000). view root applyLayout ]
or
MemoryProfiler viewProfiling: [ (1 to: 2) collect: [ :i | ConfigurationOfMetacello project currentVersion ] ]
to get a nice picture
Also, is selecting the expression in the block above, right clicking and selecting "memory profile it" equivalent to sending #viewProfiling: ?
yes
Reading your paper I get the idea that this should work, when looking at the instructions on the moose site it rather seems that I need to subclass MemoryProfiler to actually profile anything.
No need to subclass.
Cheers, Alexandre
On 09.11.2010, at 15:02, Alexandre Bergel wrote:
Ok, but please, provide feedback.
Alexandre
On 9 Nov 2010, at 10:40, Max Leske wrote:
Sounds like what I just needed! I'll try it out.
Cheers, Max
On 09.11.2010, at 12:42, Alexandre Bergel wrote:
Hi Guido,
We wrote a profiler to keep track of memory consumption.
http://bergel.eu/download/papers/Berg10g-MemoryProfiling.pdf
It will be presented at Smalltalks next week.
Cheers, Alexandre
On 8 Nov 2010, at 23:47, Guido Stepken wrote:
E.g.: Three different solutions for a Euler problem:
(1 to: 999) inject: 0 into: [:sum :i | (i \\ 3 = 0) | (i \\ 5 = 0)
ifTrue: [sum + i]
ifFalse: [sum]]
(1 to: 999) detectSum: [:i | (i \\ 3 = 0) | (i \\ 5 = 0) ifTrue: [i] ifFalse: [0]]
(1 to: 999) detectSum: [:i | i * (#(0 0 1 0 1 1 0 0 1 1 0 1 0 0 1) atWrap: i)]
How do i measure the exact memory footprint of each solution?
Pharo claims having reduced memory footprint at many places. Can that be proofed, e.g. with one comparable demo app, once run in old squeak, once in Pharo 1.1/1.2?
And no, MessageTally spyOn: does not do right!
Tnx in advance, Guido Stepken
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
participants (5)
-
Alexandre Bergel -
Guido Stepken -
Levente Uzonyi -
Mariano Martinez Peck -
Max Leske