[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #63646] Long creation times for sparseimages.m
From: |
Arun Giridhar |
Subject: |
[Octave-bug-tracker] [bug #63646] Long creation times for sparseimages.m in manual due to -svgconvert option to print |
Date: |
Sun, 15 Jan 2023 13:16:51 -0500 (EST) |
Update of bug #63646 (project octave):
Status: Confirmed => Patch Submitted
_______________________________________________________
Follow-up Comment #10:
I'm attaching a patch "svg.patch" that improves the performance some 25x
overall. Also two intermediate patches "time_old.patch" and "time_new.patch"
with time measurement code for reproducibility.
Baseline, unpatched 3678187f4355:
octave:1> clear all; tic; n = 200; a = 10*speye(n) + sparse(1:n,
ceil([1:n]/2),1,n,n) + sparse(ceil([1:n]/2),1:n,1,n,n); r1 = chol(a); spy(r1);
axis ij; toc, tic; print -nosvgconvert -depsc2 blah.eps; toc, tic; print
-svgconvert -depsc2 blah2.eps; toc
Elapsed time is 0.173405 seconds.
Elapsed time is 0.33665 seconds.
Elapsed time is 24.8665 seconds.
With instrumentation for time measurement but no change in functionality:
octave:1> clear all; tic; n = 200; a = 10*speye(n) + sparse(1:n,
ceil([1:n]/2),1,n,n) + sparse(ceil([1:n]/2),1:n,1,n,n); r1 = chol(a); spy(r1);
axis ij; toc, tic; print -nosvgconvert -depsc2 blah.eps; toc, tic; print
-svgconvert -depsc2 blah2.eps; toc
Elapsed time is 0.164773 seconds.
Elapsed time is 0.35028 seconds.
setup time 0μs
merge time 0μs
crack time 0μs
final time 3μs
setup time 0μs
merge time 0μs
crack time 0μs
final time 0μs
setup time 0μs
merge time 0μs
crack time 0μs
final time 0μs
setup time 30μs
merge time 22873717μs
crack time 787μs
final time 388μs
Elapsed time is 23.851 seconds.
Observation: unused[0] always stays false, because jj can never be 0 in
unused[jj] = true, since jj >= ii+1.
The outer for-loop on ii can therefore be eliminated, setting it to zero.
With instrumentation and that patch:
octave:1> clear all; tic; n = 200; a = 10*speye(n) + sparse(1:n,
ceil([1:n]/2),1,n,n) + sparse(ceil([1:n]/2),1:n,1,n,n); r1 = chol(a); spy(r1);
axis ij; toc, tic; print -nosvgconvert -depsc2 blah.eps; toc, tic; print
-svgconvert -depsc2 blah2.eps; toc
Elapsed time is 0.145507 seconds.
Elapsed time is 0.336081 seconds.
setup time 0μs
merge time 0μs
crack time 0μs
final time 0μs
setup time 0μs
merge time 0μs
crack time 0μs
final time 0μs
setup time 0μs
merge time 0μs
crack time 0μs
final time 0μs
setup time 34μs
merge time 4861μs
crack time 684μs
final time 363μs
Elapsed time is 0.935894 seconds.
That nested loop becomes 22873717 / 4861 == some 4700 times faster in this
case. There may be pathological cases but hopefully those are rare.
Removing the time measurement code to give the patched performance:
octave:1> clear all; tic; n = 200; a = 10*speye(n) + sparse(1:n,
ceil([1:n]/2),1,n,n) + sparse(ceil([1:n]/2),1:n,1,n,n); r1 = chol(a); spy(r1);
axis ij; toc, tic; print -nosvgconvert -depsc2 blah.eps; toc, tic; print
-svgconvert -depsc2 blah2.eps; toc
Elapsed time is 0.171607 seconds.
Elapsed time is 0.33852 seconds.
Elapsed time is 0.931587 seconds.
It would still be nice to make the svgconvert speed the same as nosvgconvert
speed but this removes one bottleneck at least.
(file #54229, file #54230, file #54231)
_______________________________________________________
Additional Item Attachment:
File name: svg.patch Size:1 KB
<https://file.savannah.gnu.org/file/svg.patch?file_id=54229>
File name: time_old.patch Size:2 KB
<https://file.savannah.gnu.org/file/time_old.patch?file_id=54230>
File name: time_new.patch Size:3 KB
<https://file.savannah.gnu.org/file/time_new.patch?file_id=54231>
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?63646>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #63646] Long creation times for sparseimages.m in manual due to -svgconvert option to print, Rik, 2023/01/13
- [Octave-bug-tracker] [bug #63646] Long creation times for sparseimages.m in manual due to -svgconvert option to print, Markus Mützel, 2023/01/13
- [Octave-bug-tracker] [bug #63646] Long creation times for sparseimages.m in manual due to -svgconvert option to print, Pantxo Diribarne, 2023/01/13
- [Octave-bug-tracker] [bug #63646] Long creation times for sparseimages.m in manual due to -svgconvert option to print, Dmitri A. Sergatskov, 2023/01/13
- [Octave-bug-tracker] [bug #63646] Long creation times for sparseimages.m in manual due to -svgconvert option to print, Dmitri A. Sergatskov, 2023/01/13
- [Octave-bug-tracker] [bug #63646] Long creation times for sparseimages.m in manual due to -svgconvert option to print, Rik, 2023/01/13
- [Octave-bug-tracker] [bug #63646] Long creation times for sparseimages.m in manual due to -svgconvert option to print, Pantxo Diribarne, 2023/01/13
- [Octave-bug-tracker] [bug #63646] Long creation times for sparseimages.m in manual due to -svgconvert option to print, Dmitri A. Sergatskov, 2023/01/13
- [Octave-bug-tracker] [bug #63646] Long creation times for sparseimages.m in manual due to -svgconvert option to print, John W. Eaton, 2023/01/13
- [Octave-bug-tracker] [bug #63646] Long creation times for sparseimages.m in manual due to -svgconvert option to print, Pantxo Diribarne, 2023/01/15
- [Octave-bug-tracker] [bug #63646] Long creation times for sparseimages.m in manual due to -svgconvert option to print,
Arun Giridhar <=
- [Octave-bug-tracker] [bug #63646] Long creation times for sparseimages.m in manual due to -svgconvert option to print, Dmitri A. Sergatskov, 2023/01/15
- [Octave-bug-tracker] [bug #63646] Long creation times for sparseimages.m in manual due to -svgconvert option to print, Arun Giridhar, 2023/01/15
- [Octave-bug-tracker] [bug #63646] Long creation times for sparseimages.m in manual due to -svgconvert option to print, Arun Giridhar, 2023/01/16
- [Octave-bug-tracker] [bug #63646] Long creation times for sparseimages.m in manual due to -svgconvert option to print, Dmitri A. Sergatskov, 2023/01/16
- [Octave-bug-tracker] [bug #63646] Long creation times for sparseimages.m in manual due to -svgconvert option to print, Markus Mützel, 2023/01/16
- [Octave-bug-tracker] [bug #63646] Long creation times for sparseimages.m in manual due to -svgconvert option to print, Dmitri A. Sergatskov, 2023/01/16
- [Octave-bug-tracker] [bug #63646] Long creation times for sparseimages.m in manual due to -svgconvert option to print, Arun Giridhar, 2023/01/16
- [Octave-bug-tracker] [bug #63646] Long creation times for sparseimages.m in manual due to -svgconvert option to print, Dmitri A. Sergatskov, 2023/01/16
- [Octave-bug-tracker] [bug #63646] Long creation times for sparseimages.m in manual due to -svgconvert option to print, Arun Giridhar, 2023/01/16
- [Octave-bug-tracker] [bug #63646] Long creation times for sparseimages.m in manual due to -svgconvert option to print, Pantxo Diribarne, 2023/01/16