Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

Small things make base men proud. -- William Shakespeare, "Henry VI"


comp / comp.lang.tcl / Re: Performance problems with "photo copy -to"

SubjectAuthor
* Performance problems with "photo copy -to"Paul Obermeier
+* Re: Performance problems with "photo copy -to"elns
|`- Re: Performance problems with "photo copy -to"elns
+* Re: Performance problems with "photo copy -to"greg
|`- Re: Performance problems with "photo copy -to"greg
+- Re: Performance problems with "photo copy -to"saito
`* Re: Performance problems with "photo copy -to"Paul Obermeier
 +- Re: Performance problems with "photo copy -to"greg
 `- Re: Performance problems with "photo copy -to"Harald Oehlmann

1
Subject: Performance problems with "photo copy -to"
From: Paul Obermeier
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Thu, 7 Nov 2024 20:43 UTC
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: obermeier@poSoft.de (Paul Obermeier)
Newsgroups: comp.lang.tcl
Subject: Performance problems with "photo copy -to"
Date: Thu, 7 Nov 2024 21:43:36 +0100
Organization: A noiseless patient Spider
Lines: 62
Message-ID: <vgj8r1$2poj6$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 07 Nov 2024 21:44:17 +0100 (CET)
Injection-Info: dont-email.me; posting-host="46bf851926abce466f1eaa465d366e67";
logging-data="2941542"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/UX3eF7cYbblE0G5Fd1MSLaZxzqhVpdpM="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:88erL0+SdW6L3SbGIClyvv0O1Kg=
View all headers

I have a simple tiling procedure and noticed a slowdown when using large images,
i.e. when doing lots of copies.

I noticed the following behaviours (both on Windows and Linux):
1. The time for copying does not grow linearly, as expected, but gets larger the more copies are involved.
2. The copy time of Tcl/Tk 9 is nearly twice the time as when using Tcl/Tk 8.6.15 or the combination
Tcl 8.7/Tk 9. So this performance degradation does not seem to stem from Tk9, but from Tcl9. Strange!

Can anybody confirm my measurements?

Thanks,
Paul

Using Tcl 8.6.15, Tk 8.6.15
Time for 100 copies: 0.69 seconds ( 6 milliseconds / copy)
Time for 400 copies: 10.26 seconds ( 25 milliseconds / copy)
Time for 900 copies: 51.12 seconds ( 56 milliseconds / copy)

Using Tcl 8.7b1, Tk 9.0.0
Time for 100 copies: 0.70 seconds ( 7 milliseconds / copy)
Time for 400 copies: 10.22 seconds ( 25 milliseconds / copy)
Time for 900 copies: 51.35 seconds ( 57 milliseconds / copy)

Using Tcl 9.0.0, Tk 9.0.0
Time for 100 copies: 1.28 seconds ( 12 milliseconds / copy)
Time for 400 copies: 19.45 seconds ( 48 milliseconds / copy)
Time for 900 copies: 98.16 seconds (109 milliseconds / copy)

package require Tk

proc Tile { phImg xRepeat yRepeat } {
set startTime [clock milliseconds]
set w [image width $phImg]
set h [image height $phImg]
set w2 [expr {$w * $xRepeat}]
set h2 [expr {$h * $yRepeat}]

set tileImg [image create photo -width $w2 -height $h2]

for { set x 0 } { $x < $xRepeat } { incr x } {
for { set y 0 } { $y < $yRepeat } { incr y } {
$tileImg copy $phImg -to [expr {$x*$w}] [expr {$y*$h}]
}
}
set endTime [clock milliseconds]
puts [format "Time for %4d copies: %5.2f seconds (%3d milliseconds / copy)" \
[expr {$xRepeat * $yRepeat}] \
[expr { ($endTime - $startTime) / 1000.0 }] \
[expr { ($endTime - $startTime) / ($xRepeat * $yRepeat) }]]
return $tileImg
}

set srcImg [image create photo -width 500 -height 500]

puts "Using Tcl [info patch], Tk [package version Tk]"
Tile $srcImg 10 10
Tile $srcImg 20 20
Tile $srcImg 30 30

exit

Subject: Re: Performance problems with "photo copy -to"
From: elns
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Thu, 7 Nov 2024 22:44 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: look@the.footer.invalid (elns)
Newsgroups: comp.lang.tcl
Subject: Re: Performance problems with "photo copy -to"
Date: Thu, 7 Nov 2024 23:44:49 +0100
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <vgjft2$2rdqa$1@dont-email.me>
References: <vgj8r1$2poj6$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 07 Nov 2024 23:44:50 +0100 (CET)
Injection-Info: dont-email.me; posting-host="50a87819e9d5ddccfaae2f0cbbd32443";
logging-data="2996042"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+gNCFaRpEDTiLlzYAvmi5KrK1jPqqEI1c="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:Q6gFWwPkhVOCSXANGU2a8wvNzXU=
In-Reply-To: <vgj8r1$2poj6$1@dont-email.me>
Content-Language: nl
View all headers

On 11/7/24 21:43, Paul Obermeier wrote:
>
> Can anybody confirm my measurements?
>

Using Tcl 8.6.15, Tk 8.6.15
Time for 100 copies: 1.31 seconds ( 13 milliseconds / copy)
Time for 400 copies: 20.32 seconds ( 50 milliseconds / copy)
Time for 900 copies: 102.27 seconds (113 milliseconds / copy)

Using Tcl 9.0.0, Tk 9.0.0
Time for 100 copies: 1.17 seconds ( 11 milliseconds / copy)
Time for 400 copies: 16.84 seconds ( 42 milliseconds / copy)
Time for 900 copies: 84.76 seconds ( 94 milliseconds / copy)

So, I see a performance increase with Tcl/Tk 9.0.0 instead of a decrease.

B.t.w.:
- Having replaced in your script [package version Tk] with $tk_patchLevel
to prevent that multiple installed Tk versions are reported.
- The combination Tcl8.7 and Tk9 is not avaiable to me
- Did you perhaps use different compiler optimizations for your builds?
(My builds are all without compiler optimizations.)

Regards,
Erik Leunissen
--
elns@ nl | Merge the left part of these two lines into one,
xs4all. | respecting a character's position in a line.

Subject: Re: Performance problems with "photo copy -to"
From: elns
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Thu, 7 Nov 2024 22:50 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: look@the.footer.invalid (elns)
Newsgroups: comp.lang.tcl
Subject: Re: Performance problems with "photo copy -to"
Date: Thu, 7 Nov 2024 23:50:48 +0100
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <vgjg88$2rdqa$2@dont-email.me>
References: <vgj8r1$2poj6$1@dont-email.me> <vgjft2$2rdqa$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 07 Nov 2024 23:50:49 +0100 (CET)
Injection-Info: dont-email.me; posting-host="50a87819e9d5ddccfaae2f0cbbd32443";
logging-data="2996042"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19HiI/D8sifcNoz+RFplV4eynvSW4MZocw="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:2ltKSddkQZknhZwtEkbMv+BvgJk=
Content-Language: nl
In-Reply-To: <vgjft2$2rdqa$1@dont-email.me>
View all headers

On 11/7/24 23:44, elns wrote:
>
> Using Tcl 8.6.15, Tk 8.6.15
> Time for  100 copies:  1.31 seconds ( 13 milliseconds / copy)
> Time for  400 copies: 20.32 seconds ( 50 milliseconds / copy)
> Time for  900 copies: 102.27 seconds (113 milliseconds / copy)
>
> Using Tcl 9.0.0, Tk 9.0.0
> Time for  100 copies:  1.17 seconds ( 11 milliseconds / copy)
> Time for  400 copies: 16.84 seconds ( 42 milliseconds / copy)
> Time for  900 copies: 84.76 seconds ( 94 milliseconds / copy)
>

This was executed on Linux.

> So, I see a performance increase with Tcl/Tk 9.0.0 instead of a decrease.
>
> B.t.w.:
> - Having replaced in your script [package version Tk] with $tk_patchLevel
>   to prevent that multiple installed Tk versions are reported.
> - The combination Tcl8.7 and Tk9 is not avaiable to me
> - Did you perhaps use different compiler optimizations for your builds?
>   (My builds are all without compiler optimizations.)
>
>
> Regards,
> Erik Leunissen

--
elns@ nl | Merge the left part of these two lines into one,
xs4all. | respecting a character's position in a line.

Subject: Re: Performance problems with "photo copy -to"
From: greg
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Fri, 8 Nov 2024 01:36 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: gregor.ebbing@gmx.de (greg)
Newsgroups: comp.lang.tcl
Subject: Re: Performance problems with "photo copy -to"
Date: Fri, 8 Nov 2024 02:36:11 +0100
Organization: A noiseless patient Spider
Lines: 89
Message-ID: <vgjpub$2t4js$1@dont-email.me>
References: <vgj8r1$2poj6$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 08 Nov 2024 02:36:11 +0100 (CET)
Injection-Info: dont-email.me; posting-host="c016d56a3120e3d13eba521e7a0d1eba";
logging-data="3052156"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+VnYtlHT1LByw5mQN2Nc/0UI5xw4kjhaY="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:4aMQPkwqgtBKsyqTP8k7uI6Tgu0=
Content-Language: de-DE
In-Reply-To: <vgj8r1$2poj6$1@dont-email.me>
View all headers

Am 07.11.24 um 21:43 schrieb Paul Obermeier:
> I have a simple tiling procedure and noticed a slowdown when using large
> images,
> i.e. when doing lots of copies.
>
> I noticed the following behaviours (both on Windows and Linux):
> 1. The time for copying does not grow linearly, as expected, but gets
> larger the more copies are involved.
> 2. The copy time of Tcl/Tk 9 is nearly twice the time as when using Tcl/
> Tk 8.6.15 or the combination
>    Tcl 8.7/Tk 9. So this performance degradation does not seem to stem
> from Tk9, but from Tcl9. Strange!
>
> Can anybody confirm my measurements?
>
> Thanks,
> Paul
>
>
> Using Tcl 8.6.15, Tk 8.6.15
> Time for  100 copies:  0.69 seconds (  6 milliseconds / copy)
> Time for  400 copies: 10.26 seconds ( 25 milliseconds / copy)
> Time for  900 copies: 51.12 seconds ( 56 milliseconds / copy)
>
> Using Tcl 8.7b1, Tk 9.0.0
> Time for  100 copies:  0.70 seconds (  7 milliseconds / copy)
> Time for  400 copies: 10.22 seconds ( 25 milliseconds / copy)
> Time for  900 copies: 51.35 seconds ( 57 milliseconds / copy)
>
> Using Tcl 9.0.0, Tk 9.0.0
> Time for  100 copies:  1.28 seconds ( 12 milliseconds / copy)
> Time for  400 copies: 19.45 seconds ( 48 milliseconds / copy)
> Time for  900 copies: 98.16 seconds (109 milliseconds / copy)
>
>
> package require Tk
>
> proc Tile { phImg xRepeat yRepeat } {
>     set startTime [clock milliseconds]
>     set w [image width  $phImg]
>     set h [image height $phImg]
>     set w2 [expr {$w * $xRepeat}]
>     set h2 [expr {$h * $yRepeat}]
>
>     set tileImg [image create photo -width $w2 -height $h2]
>
>     for { set x 0 } { $x < $xRepeat } { incr x } {
>         for { set y 0 } { $y < $yRepeat } { incr y } {
>             $tileImg copy $phImg -to [expr {$x*$w}] [expr {$y*$h}]
>         }
>     }
>     set endTime [clock milliseconds]
>     puts [format "Time for %4d copies: %5.2f seconds (%3d
> milliseconds / copy)" \
>          [expr {$xRepeat * $yRepeat}] \
>          [expr { ($endTime - $startTime) / 1000.0 }] \
>          [expr { ($endTime - $startTime) / ($xRepeat * $yRepeat) }]]
>     return $tileImg
> }
>
> set srcImg [image create photo -width 500 -height 500]
>
> puts "Using Tcl [info patch], Tk [package version Tk]"
> Tile $srcImg 10 10
> Tile $srcImg 20 20
> Tile $srcImg 30 30
>
> exit

Hello,

Using Tcl 8.6.15, Tk 8.6.15
Time for 100 copies: 1.52 seconds ( 15 milliseconds / copy)
Time for 400 copies: 23.17 seconds ( 57 milliseconds / copy)
Time for 900 copies: 117.39 seconds (130 milliseconds / copy)

Using Tcl 9.0.0, Tk 9.0.0
Time for 100 copies: 1.50 seconds ( 14 milliseconds / copy)
Time for 400 copies: 23.18 seconds ( 57 milliseconds / copy)
Time for 900 copies: 117.57 seconds (130 milliseconds / copy)

both Tcl/Tk from debian sid

Gregor

Subject: Re: Performance problems with "photo copy -to"
From: saito
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Fri, 8 Nov 2024 04:18 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: saitology9@gmail.com (saito)
Newsgroups: comp.lang.tcl
Subject: Re: Performance problems with "photo copy -to"
Date: Thu, 7 Nov 2024 23:18:12 -0500
Organization: A noiseless patient Spider
Lines: 42
Message-ID: <vgk3e5$3255t$1@dont-email.me>
References: <vgj8r1$2poj6$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 08 Nov 2024 05:18:14 +0100 (CET)
Injection-Info: dont-email.me; posting-host="ce2d134e09b7d776ee9b64779e310d31";
logging-data="3216573"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+S8SeLMgdVcJB0p4ceW7ij"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:+1v1fds8zROYSBtZuluroZPBDBs=
Content-Language: en-US
In-Reply-To: <vgj8r1$2poj6$1@dont-email.me>
View all headers

On 11/7/2024 3:43 PM, Paul Obermeier wrote:
> I have a simple tiling procedure and noticed a slowdown when using large
> images,
> i.e. when doing lots of copies.
>
> I noticed the following behaviours (both on Windows and Linux):
> 1. The time for copying does not grow linearly, as expected, but gets
> larger the more copies are involved.
> 2. The copy time of Tcl/Tk 9 is nearly twice the time as when using Tcl/
> Tk 8.6.15 or the combination
>    Tcl 8.7/Tk 9. So this performance degradation does not seem to stem
> from Tk9, but from Tcl9. Strange!
>
> Can anybody confirm my measurements?
>

I wonder if it has something to do with memory management for images.

On Windows Tcl/Tk 8.6.12, I first got results very close to your Tcl/Tk
9.0.0 versions. I ran it again and it got worse. It was embarrassingly
slow so I won't disclose it here. Let's say the numbers almost tripled,
and it worsened with the size of the images.

But then it errored out with a funny message :-)

> not enough free memory for image buffer

The code was not deleting the images so it was running out of memory.

So I changed your code slightly and got these results:

% image delete [Tile $srcImg 10 10]
Time for 100 copies: 1.24 seconds ( 12 milliseconds / copy)

% image delete [Tile $srcImg 20 20]
Time for 400 copies: 19.01 seconds ( 47 milliseconds / copy)

....

Subject: Re: Performance problems with "photo copy -to"
From: greg
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Fri, 8 Nov 2024 21:22 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: gregor.ebbing@gmx.de (greg)
Newsgroups: comp.lang.tcl
Subject: Re: Performance problems with "photo copy -to"
Date: Fri, 8 Nov 2024 22:22:59 +0100
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <vglvfj$3c2d6$1@dont-email.me>
References: <vgj8r1$2poj6$1@dont-email.me> <vgjpub$2t4js$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 08 Nov 2024 22:23:00 +0100 (CET)
Injection-Info: dont-email.me; posting-host="1a852a6736eef864d59b31af4d61fd4a";
logging-data="3541414"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1918vgKsXHSpuLm3B4hcepbs5iGh/b0+Gs="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:oNwP636TP0VEzZpei/8/2Wa8qsI=
Content-Language: de-DE
In-Reply-To: <vgjpub$2t4js$1@dont-email.me>
View all headers

Am 08.11.24 um 02:36 schrieb greg:
> Am 07.11.24 um 21:43 schrieb Paul Obermeier:
>> I have a simple tiling procedure and noticed a slowdown when using

>
>
> Hello,
>
>
> Using Tcl 8.6.15, Tk 8.6.15
> Time for  100 copies:  1.52 seconds ( 15 milliseconds / copy)
> Time for  400 copies: 23.17 seconds ( 57 milliseconds / copy)
> Time for  900 copies: 117.39 seconds (130 milliseconds / copy)
>
>
> Using Tcl 9.0.0, Tk 9.0.0
> Time for  100 copies:  1.50 seconds ( 14 milliseconds / copy)
> Time for  400 copies: 23.18 seconds ( 57 milliseconds / copy)
> Time for  900 copies: 117.57 seconds (130 milliseconds / copy)
>
>
> both Tcl/Tk from debian sid
>
>
> Gregor

Windows 10 with the last Bawt (KVM)
Using Tcl 8.6.13, Tk 8.6.13
Time for 100 copies: 3.15 seconds ( 31 milliseconds / copy)
Time for 400 copies: 42.10 seconds (105 milliseconds / copy)
Time for 900 copies: 201.18 seconds (223 milliseconds / copy)

Windows 10 with the last Magicsplat (KVM)
Using Tcl 9.0.0, Tk 9.0.0
Time for 100 copies: 2.71 seconds ( 27 milliseconds / copy)
Time for 400 copies: 39.80 seconds ( 99 milliseconds / copy)
Time for 900 copies: 184.96 seconds (205 milliseconds / copy)

Subject: Re: Performance problems with "photo copy -to"
From: Paul Obermeier
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Fri, 8 Nov 2024 21:48 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: obermeier@poSoft.de (Paul Obermeier)
Newsgroups: comp.lang.tcl
Subject: Re: Performance problems with "photo copy -to"
Date: Fri, 8 Nov 2024 22:48:05 +0100
Organization: A noiseless patient Spider
Lines: 99
Message-ID: <vgm0vv$3c2ek$1@dont-email.me>
References: <vgj8r1$2poj6$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 08 Nov 2024 22:48:47 +0100 (CET)
Injection-Info: dont-email.me; posting-host="39a5e33ac5ea927e7465706a9cf04612";
logging-data="3541460"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/S2EUAIWpuznjfut9Jlz2nfy8ZlNHvjIU="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:lRJ3DSd9wKp6BbfYcYmskWNkxPw=
In-Reply-To: <vgj8r1$2poj6$1@dont-email.me>
View all headers

After some more tests it looks like the source of the problem with issue 1 is the handling of the alpha channel.

I created 4 test images and rewrote the test script.

One image contains just 3 channels (RGB) and three images contain 4 channels (RGBA),
where the alpha channel is either fully opaque, fully transparent or partial transparent.
Only the partial transparent image behaves as expected, i.e. has linear time increase.

Using Tcl 9.0.0, Tk 9.0.0
Using file Balls-3chan.png
Time for 100 copies: 1.36 seconds ( 13 milliseconds / copy)
Time for 400 copies: 20.14 seconds ( 50 milliseconds / copy)
Using file Balls-4chan-transp.png
Time for 100 copies: 1.27 seconds ( 12 milliseconds / copy)
Time for 400 copies: 19.82 seconds ( 49 milliseconds / copy)
Using file Balls-4chan-opaque.png
Time for 100 copies: 1.36 seconds ( 13 milliseconds / copy)
Time for 400 copies: 20.18 seconds ( 50 milliseconds / copy)
Using file Balls-4chan-partial.png
Time for 100 copies: 0.13 seconds ( 1 milliseconds / copy)
Time for 400 copies: 0.56 seconds ( 1 milliseconds / copy)

Find the test images and the script at https://www.tcl3d.org/download/PhotoCopyBug.zip
If someone again can confirm the above behaviour, I would create a Tk ticket.

Regarding issue 2 I get totally different results on various systems:
Fedora 40 : No time differences between Tcl/Tk versions.
Suse 15.6 : No time differences between Tcl/Tk versions.
Ubuntu 24 : Tcl/Tk9 twice as fast as the other combinations.
Debian 12.6: Tcl/Tk9 twice as slow as the other combinations.
Windows 11 : Tcl/Tk8.6.15 twice as fast as the other combinations.

Paul

Am 07.11.2024 um 21:43 schrieb Paul Obermeier:
> I have a simple tiling procedure and noticed a slowdown when using large images,
> i.e. when doing lots of copies.
>
> I noticed the following behaviours (both on Windows and Linux):
> 1. The time for copying does not grow linearly, as expected, but gets larger the more copies are involved.
> 2. The copy time of Tcl/Tk 9 is nearly twice the time as when using Tcl/Tk 8.6.15 or the combination
>    Tcl 8.7/Tk 9. So this performance degradation does not seem to stem from Tk9, but from Tcl9. Strange!
>
> Can anybody confirm my measurements?
>
> Thanks,
> Paul
>
>
> Using Tcl 8.6.15, Tk 8.6.15
> Time for  100 copies:  0.69 seconds (  6 milliseconds / copy)
> Time for  400 copies: 10.26 seconds ( 25 milliseconds / copy)
> Time for  900 copies: 51.12 seconds ( 56 milliseconds / copy)
>
> Using Tcl 8.7b1, Tk 9.0.0
> Time for  100 copies:  0.70 seconds (  7 milliseconds / copy)
> Time for  400 copies: 10.22 seconds ( 25 milliseconds / copy)
> Time for  900 copies: 51.35 seconds ( 57 milliseconds / copy)
>
> Using Tcl 9.0.0, Tk 9.0.0
> Time for  100 copies:  1.28 seconds ( 12 milliseconds / copy)
> Time for  400 copies: 19.45 seconds ( 48 milliseconds / copy)
> Time for  900 copies: 98.16 seconds (109 milliseconds / copy)
>
>
> package require Tk
>
> proc Tile { phImg xRepeat yRepeat } {
>     set startTime [clock milliseconds]
>     set w [image width  $phImg]
>     set h [image height $phImg]
>     set w2 [expr {$w * $xRepeat}]
>     set h2 [expr {$h * $yRepeat}]
>
>     set tileImg [image create photo -width $w2 -height $h2]
>
>     for { set x 0 } { $x < $xRepeat } { incr x } {
>         for { set y 0 } { $y < $yRepeat } { incr y } {
>             $tileImg copy $phImg -to [expr {$x*$w}] [expr {$y*$h}]
>         }
>     }
>     set endTime [clock milliseconds]
>     puts [format "Time for %4d copies: %5.2f seconds (%3d milliseconds / copy)" \
>          [expr {$xRepeat * $yRepeat}] \
>          [expr { ($endTime - $startTime) / 1000.0 }] \
>          [expr { ($endTime - $startTime) / ($xRepeat * $yRepeat) }]]
>     return $tileImg
> }
>
> set srcImg [image create photo -width 500 -height 500]
>
> puts "Using Tcl [info patch], Tk [package version Tk]"
> Tile $srcImg 10 10
> Tile $srcImg 20 20
> Tile $srcImg 30 30
>
> exit

Subject: Re: Performance problems with "photo copy -to"
From: greg
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Sat, 9 Nov 2024 00:05 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: gregor.ebbing@gmx.de (greg)
Newsgroups: comp.lang.tcl
Subject: Re: Performance problems with "photo copy -to"
Date: Sat, 9 Nov 2024 01:05:01 +0100
Organization: A noiseless patient Spider
Lines: 79
Message-ID: <vgm8vd$3dpqm$1@dont-email.me>
References: <vgj8r1$2poj6$1@dont-email.me> <vgm0vv$3c2ek$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 09 Nov 2024 01:05:02 +0100 (CET)
Injection-Info: dont-email.me; posting-host="4a6fc82d8bbafcd267f6323e14902e34";
logging-data="3598166"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19O6JlXWJwd/w45CvGmFUeUw6DJDjZBc5c="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:u3R2D2ab9Ba3r7F+YiPVmpce/Gw=
Content-Language: de-DE
In-Reply-To: <vgm0vv$3c2ek$1@dont-email.me>
View all headers

Am 08.11.24 um 22:48 schrieb Paul Obermeier:
> After some more tests it looks like the source of the problem with issue
> 1 is the handling of the alpha channel.
....
Hello,

photocopy.tcl

Debian Sid, Debian 6.11.6-1

Using Tcl 8.6.15, Tk 8.6.15
Using file Balls-3chan.png
Time for 100 copies: 1.52 seconds ( 15 milliseconds / copy)
Time for 400 copies: 23.30 seconds ( 58 milliseconds / copy)
Using file Balls-4chan-transp.png
Time for 100 copies: 1.51 seconds ( 15 milliseconds / copy)
Time for 400 copies: 23.27 seconds ( 58 milliseconds / copy)
Using file Balls-4chan-opaque.png
Time for 100 copies: 1.52 seconds ( 15 milliseconds / copy)
Time for 400 copies: 23.35 seconds ( 58 milliseconds / copy)
Using file Balls-4chan-partial.png
Time for 100 copies: 0.09 seconds ( 0 milliseconds / copy)
Time for 400 copies: 0.34 seconds ( 0 milliseconds / copy)

Using Tcl 9.0.0, Tk 9.0.0
Using file Balls-3chan.png
Time for 100 copies: 1.52 seconds ( 15 milliseconds / copy)
Time for 400 copies: 23.38 seconds ( 58 milliseconds / copy)
Using file Balls-4chan-transp.png
Time for 100 copies: 1.51 seconds ( 15 milliseconds / copy)
Time for 400 copies: 23.43 seconds ( 58 milliseconds / copy)
Using file Balls-4chan-opaque.png
Time for 100 copies: 1.52 seconds ( 15 milliseconds / copy)
Time for 400 copies: 23.39 seconds ( 58 milliseconds / copy)
Using file Balls-4chan-partial.png
Time for 100 copies: 0.08 seconds ( 0 milliseconds / copy)
Time for 400 copies: 0.35 seconds ( 0 milliseconds / copy)

Windows 10 (KVM)

Bawt Tcl/Tk

Using Tcl 8.6.13, Tk 8.6.13
Using file Balls-3chan.png
Time for 100 copies: 2.06 seconds ( 20 milliseconds / copy)
Time for 400 copies: 35.67 seconds ( 89 milliseconds / copy)
Using file Balls-4chan-transp.png
Time for 100 copies: 2.11 seconds ( 21 milliseconds / copy)
Time for 400 copies: 33.44 seconds ( 83 milliseconds / copy)
Using file Balls-4chan-opaque.png
Time for 100 copies: 2.38 seconds ( 23 milliseconds / copy)
Time for 400 copies: 32.56 seconds ( 81 milliseconds / copy)
Using file Balls-4chan-partial.png
Time for 100 copies: 0.26 seconds ( 2 milliseconds / copy)
Time for 400 copies: 1.15 seconds ( 2 milliseconds / copy)

Magicsplat Tcl/Tk

Using Tcl 9.0.0, Tk 9.0.0
Using file Balls-3chan.png
Time for 100 copies: 1.97 seconds ( 19 milliseconds / copy)
Time for 400 copies: 28.32 seconds ( 70 milliseconds / copy)
Using file Balls-4chan-transp.png
Time for 100 copies: 1.78 seconds ( 17 milliseconds / copy)
Time for 400 copies: 27.21 seconds ( 68 milliseconds / copy)
Using file Balls-4chan-opaque.png
Time for 100 copies: 1.97 seconds ( 19 milliseconds / copy)
Time for 400 copies: 28.12 seconds ( 70 milliseconds / copy)
Using file Balls-4chan-partial.png
Time for 100 copies: 0.28 seconds ( 2 milliseconds / copy)
Time for 400 copies: 1.09 seconds ( 2 milliseconds / copy)

Gregor

Subject: Re: Performance problems with "photo copy -to"
From: Harald Oehlmann
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Sun, 10 Nov 2024 15:04 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: wortkarg3@yahoo.com (Harald Oehlmann)
Newsgroups: comp.lang.tcl
Subject: Re: Performance problems with "photo copy -to"
Date: Sun, 10 Nov 2024 16:04:52 +0100
Organization: A noiseless patient Spider
Lines: 120
Message-ID: <vgqi2i$e5uc$1@dont-email.me>
References: <vgj8r1$2poj6$1@dont-email.me> <vgm0vv$3c2ek$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 10 Nov 2024 16:04:50 +0100 (CET)
Injection-Info: dont-email.me; posting-host="141381629990736127a3e914f4075b95";
logging-data="464844"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Kh4f86mrvf5gjEXJ3UD9X"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:e8zeuelTVVEfW6eo18aJ/LymKHQ=
In-Reply-To: <vgm0vv$3c2ek$1@dont-email.me>
Content-Language: en-GB
View all headers

The horrible performence of images with an alpha channel on WIndows and
Mac-OS is a long standing bug and subject of many tickets....

It would be great to attack this issue...

Thanks,
Harald

Am 08.11.2024 um 22:48 schrieb Paul Obermeier:
> After some more tests it looks like the source of the problem with issue
> 1 is the handling of the alpha channel.
>
> I created 4 test images and rewrote the test script.
>
> One image contains just 3 channels (RGB) and three images contain 4
> channels (RGBA),
> where the alpha channel is either fully opaque, fully transparent or
> partial transparent.
> Only the partial transparent image behaves as expected, i.e. has linear
> time increase.
>
> Using Tcl 9.0.0, Tk 9.0.0
> Using file Balls-3chan.png
> Time for  100 copies:  1.36 seconds ( 13 milliseconds / copy)
> Time for  400 copies: 20.14 seconds ( 50 milliseconds / copy)
> Using file Balls-4chan-transp.png
> Time for  100 copies:  1.27 seconds ( 12 milliseconds / copy)
> Time for  400 copies: 19.82 seconds ( 49 milliseconds / copy)
> Using file Balls-4chan-opaque.png
> Time for  100 copies:  1.36 seconds ( 13 milliseconds / copy)
> Time for  400 copies: 20.18 seconds ( 50 milliseconds / copy)
> Using file Balls-4chan-partial.png
> Time for  100 copies:  0.13 seconds (  1 milliseconds / copy)
> Time for  400 copies:  0.56 seconds (  1 milliseconds / copy)
>
> Find the test images and the script at https://www.tcl3d.org/download/
> PhotoCopyBug.zip
> If someone again can confirm the above behaviour, I would create a Tk
> ticket.
>
> Regarding issue 2 I get totally different results on various systems:
> Fedora 40  : No time differences between Tcl/Tk versions.
> Suse 15.6  : No time differences between Tcl/Tk versions.
> Ubuntu 24  : Tcl/Tk9 twice as fast as the other combinations.
> Debian 12.6: Tcl/Tk9 twice as slow as the other combinations.
> Windows 11 : Tcl/Tk8.6.15 twice as fast as the other combinations.
>
> Paul
>
>
> Am 07.11.2024 um 21:43 schrieb Paul Obermeier:
>> I have a simple tiling procedure and noticed a slowdown when using
>> large images,
>> i.e. when doing lots of copies.
>>
>> I noticed the following behaviours (both on Windows and Linux):
>> 1. The time for copying does not grow linearly, as expected, but gets
>> larger the more copies are involved.
>> 2. The copy time of Tcl/Tk 9 is nearly twice the time as when using
>> Tcl/Tk 8.6.15 or the combination
>>     Tcl 8.7/Tk 9. So this performance degradation does not seem to
>> stem from Tk9, but from Tcl9. Strange!
>>
>> Can anybody confirm my measurements?
>>
>> Thanks,
>> Paul
>>
>>
>> Using Tcl 8.6.15, Tk 8.6.15
>> Time for  100 copies:  0.69 seconds (  6 milliseconds / copy)
>> Time for  400 copies: 10.26 seconds ( 25 milliseconds / copy)
>> Time for  900 copies: 51.12 seconds ( 56 milliseconds / copy)
>>
>> Using Tcl 8.7b1, Tk 9.0.0
>> Time for  100 copies:  0.70 seconds (  7 milliseconds / copy)
>> Time for  400 copies: 10.22 seconds ( 25 milliseconds / copy)
>> Time for  900 copies: 51.35 seconds ( 57 milliseconds / copy)
>>
>> Using Tcl 9.0.0, Tk 9.0.0
>> Time for  100 copies:  1.28 seconds ( 12 milliseconds / copy)
>> Time for  400 copies: 19.45 seconds ( 48 milliseconds / copy)
>> Time for  900 copies: 98.16 seconds (109 milliseconds / copy)
>>
>>
>> package require Tk
>>
>> proc Tile { phImg xRepeat yRepeat } {
>>      set startTime [clock milliseconds]
>>      set w [image width  $phImg]
>>      set h [image height $phImg]
>>      set w2 [expr {$w * $xRepeat}]
>>      set h2 [expr {$h * $yRepeat}]
>>
>>      set tileImg [image create photo -width $w2 -height $h2]
>>
>>      for { set x 0 } { $x < $xRepeat } { incr x } {
>>          for { set y 0 } { $y < $yRepeat } { incr y } {
>>              $tileImg copy $phImg -to [expr {$x*$w}] [expr {$y*$h}]
>>          }
>>      }
>>      set endTime [clock milliseconds]
>>      puts [format "Time for %4d copies: %5.2f seconds (%3d
>> milliseconds / copy)" \
>>           [expr {$xRepeat * $yRepeat}] \
>>           [expr { ($endTime - $startTime) / 1000.0 }] \
>>           [expr { ($endTime - $startTime) / ($xRepeat * $yRepeat) }]]
>>      return $tileImg
>> }
>>
>> set srcImg [image create photo -width 500 -height 500]
>>
>> puts "Using Tcl [info patch], Tk [package version Tk]"
>> Tile $srcImg 10 10
>> Tile $srcImg 20 20
>> Tile $srcImg 30 30
>>
>> exit
>

1

rocksolid light 0.9.8
clearnet tor