Bug 391262 - Efficient sperarate run and render tasks
Summary: Efficient sperarate run and render tasks
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: BIRT (show other bugs)
Version: 4.2.1   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Birt-ReportEngine-inbox@eclipse.org CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-05 14:48 EDT by Thomas Zimmermann CLA
Modified: 2012-10-05 16:10 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Zimmermann CLA 2012-10-05 14:48:25 EDT
There are obvious differences in the behaviour of IRunAndRenderTask and separate run and render tasks. Right now, separate run and render tasks provide the most flexibility out of the two options (for example <VIEWTIME-VALUE-OF>, onRender-scripts on the masterpage etc.).

If one wants to use separate run and render tasks, there are currently two options:

1. Run the report to File/Folder archive and read it back in from there.
2. Provide a custom IDocArchiveWriter/IDocArchiveReader that saves the intermediate format in RAM, possibly swapping to disk if the amount of data gets too large.

Option 1 is suboptimal, because it involves disk access when it may not be needed, decreasing performance.

Option 2 requires a custom implementation, because there is no implementation bundled with BIRT.



Suggestions:
1. Provide a IRunThenRenderTask that provides the same semantics and runtime behaviour as separate run and render tasks but without the need to set this up manually. This custom task could then also do some optimizations under the hood, similiar to IRunAndRenderTask.

2. FileArchiveWriter seems like it provides most of Option 2 already, but always wirtes to disk. It could be tweaked to allow for a treshold number of bytes to be written into a buffer before swapping to tempfiles on disk. That way, smaller reports will be blazing fast and bigger reports won't run out of memory.
This could be used to implement suggestion 1 or allow the user to do it himself more easily.
Comment 1 Wei Yan CLA 2012-10-05 14:52:05 EDT
Try

ArchiveFile af = new ArchiveFile("name", "rwt");
af.setCacheSize();

"t" means transient. The name is a temporary file in case the file size is larger than cache size. Once it is closed, the file will be removed from temp disk.
Comment 2 Thomas Zimmermann CLA 2012-10-05 16:10:46 EDT
Wow, thanks for the fast answer. This bugtracker is more like a chat. :)

Thanks for the hint to ArchiveFile, seems like there already is a lot of the needed functionality. That makes implementing this a lot easier.

Sadly, ArchiveFile does not implement IDocArchiveWriter and IDocArchiveReader, so it can't be used directly in (shortened):

runTask.run(archiveFile);
IReportDocument reportDocument = engine.openReportDocument("", archiveFile, options);
IRenderTask renderTask = engine.createRenderTask(reportDocument);
renderTask.render();

Well, thanks for pointing me in the general direction. If I find the time, I'll do something with it.

I would still think that a separate provided IRunThenRenderTask would be awesome, but if there are no plans for this, I'm fine with that.

Best regards,
Thomas