Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 371339

Summary: Dot4Zest is slow due to use of temp files
Product: [Tools] GEF Reporter: Jörn Guy Süß <jgsuess>
Component: GEF-Legacy GEF (MVC)Assignee: gef-inbox <gef-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: steeg
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Jörn Guy Süß CLA 2012-02-12 23:52:23 EST
Build Identifier: 3.7.1 M20110909-1335

All calls to new DotGraph() run through the call hierarchy shown below. The calls end in the method DotFileUtils.write(). This method is fairly slow and produces temp files that are not deleted (problematic practice if the component is to be used for anything business critical). I wonder if it would be possible to use an in-memory representation for the source code buffer instead? If that is not possible, at least redirect the files into the plugins managed cache in the users workspace. Erasing the workspace would then remove the files.

org.eclipse.zest.internal.dot.DotFileUtils.write(String):

	/**
	 * @param text
	 *            The string to write out to a temp file
	 * @return The temp file containing the given string
	 */
	public static File write(final String text) {
		try {
			return write(text, File.createTempFile("zest", ".dot")); //$NON-NLS-1$//$NON-NLS-2$
		} catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	}




write(String) : File - org.eclipse.zest.internal.dot.DotFileUtils
	loadFrom(String) : void - org.eclipse.zest.internal.dot.DotImport
		init(String) : void - org.eclipse.zest.internal.dot.DotImport (2 matches)
			DotImport(String) - org.eclipse.zest.internal.dot.DotImport
				add(String) : DotGraph - org.eclipse.zest.dot.DotGraph
				DotGraph(String, Composite, int) - org.eclipse.zest.dot.DotGraph
	toImage(String, String, String) : File - org.eclipse.zest.internal.dot.DotExport
		toImage(String, String) : File - org.eclipse.zest.internal.dot.DotExport

Reproducible: Always

Steps to Reproduce:
1. Visualize any graph with dot4zest, e.g. using the tutorial
2. Inspect your temporary directory (%temp%) on windows (~/var) on *nix
3. Find files named zestXXXXX.dot, where XXXX is a long random number.
4. Varify that these files contain (and expose) a dot representation of your graph.
Comment 1 Fabian Steeg CLA 2012-02-13 16:25:18 EST
Thanks for the bug!

Fixed in master - temp files are no longer created when loading DOT strings:

http://git.eclipse.org/c/gef/org.eclipse.zest.git/commit/?id=bf3a79af6a19e2cbff