View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003504KWWidgetspublic2006-07-13 12:522007-08-28 15:55
ReporterSteve Pieper 
Assigned ToSebastien Barre 
PrioritynormalSeverityfeatureReproducibilityalways
StatusassignedResolutionopen 
PlatformOSOS Version
Summary0003504: "on demand' loading of vtk packages and commands
DescriptionWhat's the best way to do the equivelent of a 'package require' for sub-parts of vtk from within the kwapplication.

Even better would be to have a 'lazy evaluation' to load commands as they are needed. E.g. one could catch 'invalid command name' errors in the interpreter and see if they correspond to a package. Ideally the vtk commands could be subdivided into smaller bundles that load more quickly (there are many vtk classes that are almost never needed).

http://wiki.na-mic.org/Wiki/index.php/Slicer3:Interface_Design_and_Usability:Open_Questions#Any_way_to_speed_up_application_start_time.3F_Can_we_avoid_loading_all_of_vtk_into_the_interpreter_by_breaking_it_up_into_smaller_packages_and_only_loading_what_we_actually_need. [^]
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0004471)
Sebastien Barre (manager)
2006-07-18 11:54

My opinion on that one is that it is a very advanced feature we are talking about. The cost of requiring each widget in the library to state what part of VTK they need, and ask the application to load it beforehand (or make sure it is loaded), seems to be pretty high/risky in terms of maintenance: I can definitely see developpers (including myself) forgetting to require a specific package after updating the code, and this won't be caught until much later (if ever) since we probably don't exercise all the callbacks. Also the error message would expose the whole ugly wrapping mechanism to the user, adding to the confusion.

I would rather everything being loaded and be sure it works. Now I'm not sure I even see the penalty of loading all commands in the interpreter, launching an example like the medical image viewer is almost instantenous on my machine, but I moved the VTK init code to vtkKWApplication::InitializeVTK(), which can be overriden by Slicer's subclass of vtkKWApplication to load only the package you guys think are going to need... Would that do the trick ?
Now I'm not sure how you can catch an "invalid command name" and decide which VTK package should be loaded... I welcome any code.
(0004472)
Steve Pieper (reporter)
2006-07-18 13:23

Hi Sebastien -

I don't have any code for this in C++, but in tcl an example is the auto_load mechanism where an automatic index is created for each package. Then it's possible to catch an error for a missing command and try to load it.
http://www.tcl.tk/man/tcl8.0/TclCmd/library.htm#M7 [^]

Regaring load times, it matters a lot if the libary is already cached or needs to be read from disks.

-Steve
(0004475)
Sebastien Barre (manager)
2006-07-18 13:47

I know about auto_load and the package index, but we are at the C++ level here, and there are no such pkg_index in VTK anyway... So I'm not sure how to do what you want here.

Regarding loading time, if this is the DLL loading time that matters to you, not the time it takes to bring the commands in the interpreter, then sadly we can't do anything here, since we have to link against those DLLs anyway. Unless we were to open them manually, but I'm not sure we have any robust enough for such cross-platform feat. Now as I mentioned in the past, your final application will be all statically linked, am I right ?

 Issue History
Date Modified Username Field Change
2007-08-28 15:54 Zack Galbreath Project DataFusion => KWWidgets
2007-08-28 15:55 Zack Galbreath Assigned To Terry Gerts => Sebastien Barre
2007-08-28 15:55 Zack Galbreath Severity major => feature
2007-08-28 15:55 Zack Galbreath Status new => assigned
2007-08-28 15:55 Zack Galbreath Resolution no change required => open
2007-08-28 15:55 Zack Galbreath Summary Goodsite => "on demand' loading of vtk packages and commands
2007-08-28 15:55 Zack Galbreath Note Deleted: 0008155


Copyright © 2000 - 2018 MantisBT Team