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
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
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?
not enough free memory for image buffer
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
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
After some more tests it looks like the source of the problem with issue...
1 is the handling of the alpha channel.
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
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 993 |
Nodes: | 10 (0 / 10) |
Uptime: | 206:58:45 |
Calls: | 12,972 |
Calls today: | 1 |
Files: | 186,574 |
Messages: | 3,268,388 |