The method Form>>rotateBy: slows down if applied several times to the same form

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

The method Form>>rotateBy: slows down if applied several times to the same form

Pharo Smalltalk Users mailing list
Dears,
   applying the method "Form>>rotateBy:" several times, to the same
form, the system slows down dramatically, even imposing a 0° rotation.

Below you can find a code snippet, to be run on the playground:

|aForm |
aForm:= ImageReadWriter formFromFileNamed: 'pharo.png'.
10 timesRepeat: [ aForm := aForm rotateBy:90 ].


Increasing the number of repetitions the delay get worse.

Does someone else get the same issue?
Is there something wrong on my code, or in the way I'm using the method?



The test has been launched in a Pharo 6.0 image, Latest update: #60499,
under Linux 64bit.


For this question I opened the FogBugz case n°20216

https://pharo.fogbugz.com/f/cases/20216#BugEvent.190469


Thanks,
Matteo

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: The method Form>>rotateBy: slows down if applied several times to the same form

Nicolai Hess-3-2


2017-07-04 23:54 GMT+02:00 Matteo via Pharo-users <[hidden email]>:


---------- Weitergeleitete Nachricht ----------
From: Matteo <[hidden email]>
To: "Pharo is welcome (ML)" <[hidden email]>
Cc: 
Bcc: 
Date: Tue, 4 Jul 2017 23:54:06 +0200
Subject: The method Form>>rotateBy: slows down if applied several times to the same form
Dears,
   applying the method "Form>>rotateBy:" several times, to the same
form, the system slows down dramatically, even imposing a 0° rotation.

Below you can find a code snippet, to be run on the playground:

|aForm |
aForm:= ImageReadWriter formFromFileNamed: 'pharo.png'.
10 timesRepeat: [ aForm := aForm rotateBy:90 ].


Increasing the number of repetitions the delay get worse.

Does someone else get the same issue?
Is there something wrong on my code, or in the way I'm using the method?



Hi Matteo,

thanks for this contribution.
It is good that you found out the reason for the slowing down (repeatly creating a bigger form is of course not good).

I looked at your fix, it seems to work but both new methods are nearly identically, maybe it would be better to create another method for the common parts.

And I saw that there is another method

Form
rotateBy: direction centerAt: aPoint

with direction could be either #left or #right and it will rotate cw/ccw by 90 degree

would this be useable for your use case?

nicolai

 

The test has been launched in a Pharo 6.0 image, Latest update: #60499,
under Linux 64bit.


For this question I opened the FogBugz case n°20216

https://pharo.fogbugz.com/f/cases/20216#BugEvent.190469


Thanks,
Matteo



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: The method Form>>rotateBy: slows down if applied several times to the same form

Pharo Smalltalk Users mailing list



On 10/07/17 21:54, Nicolai Hess wrote:


2017-07-04 23:54 GMT+02:00 Matteo via Pharo-users <[hidden email]>:


---------- Weitergeleitete Nachricht ----------
From: Matteo <[hidden email]>
To: "Pharo is welcome (ML)" <[hidden email]>
Cc: 
Bcc: 
Date: Tue, 4 Jul 2017 23:54:06 +0200
Subject: The method Form>>rotateBy: slows down if applied several times to the same form
Dears,
   applying the method "Form>>rotateBy:" several times, to the same
form, the system slows down dramatically, even imposing a 0° rotation.

Below you can find a code snippet, to be run on the playground:

|aForm |
aForm:= ImageReadWriter formFromFileNamed: 'pharo.png'.
10 timesRepeat: [ aForm := aForm rotateBy:90 ].


Increasing the number of repetitions the delay get worse.

Does someone else get the same issue?
Is there something wrong on my code, or in the way I'm using the method?



Hi Matteo,

thanks for this contribution.
It is good that you found out the reason for the slowing down (repeatly creating a bigger form is of course not good).

I looked at your fix, it seems to work but both new methods are nearly identically, maybe it would be better to create another method for the common parts.

And I saw that there is another method

Form
rotateBy: direction centerAt: aPoint

with direction could be either #left or #right and it will rotate cw/ccw by 90 degree

would this be useable for your use case?

nicolai

 


Hi Nicolai,
    you're right: my methods "rotateByQuarterCCW" and "rotateByQuarterCW" are redundant.
   
    The method "rotateBy: direction centerAt: aPoint" does the same thing.


    Sorry for the trouble, but I got misled be the selectors:
        "rotateBy:"
        "rotateBy:smoothing:"
        "rotateBy:magnify:smoothing:"

    that works differently than "rotateBy:centerAt:".



    What should I do with the fogbugz n° 20216?

Thanks,
Matteo
   


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: The method Form>>rotateBy: slows down if applied several times to the same form

Nicolai Hess-3-2
In reply to this post by Nicolai Hess-3-2


2017-07-11 20:59 GMT+02:00 Matteo <[hidden email]>:



On 10/07/17 21:54, Nicolai Hess wrote:


2017-07-04 23:54 GMT+02:00 Matteo via Pharo-users <[hidden email]>:


---------- Weitergeleitete Nachricht ----------
From: Matteo <[hidden email]>
To: "Pharo is welcome (ML)" <[hidden email]>
Cc: 
Bcc: 
Date: Tue, 4 Jul 2017 23:54:06 +0200
Subject: The method Form>>rotateBy: slows down if applied several times to the same form
Dears,
   applying the method "Form>>rotateBy:" several times, to the same
form, the system slows down dramatically, even imposing a 0° rotation.

Below you can find a code snippet, to be run on the playground:

|aForm |
aForm:= ImageReadWriter formFromFileNamed: 'pharo.png'.
10 timesRepeat: [ aForm := aForm rotateBy:90 ].


Increasing the number of repetitions the delay get worse.

Does someone else get the same issue?
Is there something wrong on my code, or in the way I'm using the method?



Hi Matteo,

thanks for this contribution.
It is good that you found out the reason for the slowing down (repeatly creating a bigger form is of course not good).

I looked at your fix, it seems to work but both new methods are nearly identically, maybe it would be better to create another method for the common parts.

And I saw that there is another method

Form
rotateBy: direction centerAt: aPoint

with direction could be either #left or #right and it will rotate cw/ccw by 90 degree

would this be useable for your use case?

nicolai

 


Hi Nicolai,
    you're right: my methods "rotateByQuarterCCW" and "rotateByQuarterCW" are redundant.
   
    The method "rotateBy: direction centerAt: aPoint" does the same thing.


    Sorry for the trouble, but I got misled be the selectors:
        "rotateBy:"
        "rotateBy:smoothing:"
        "rotateBy:magnify:smoothing:"

    that works differently than "rotateBy:centerAt:".



    What should I do with the fogbugz n° 20216?

Thanks,
Matteo

Yes, I think it is Ok, to close the issue (as you already did).
And it is good to comment why this is closed and what method can be used instead.

Thank you Matteo.




 
   



Loading...