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

Bug 280453

Summary: [performance] DefaultFileServiceCodePageConverter is wasteful with main memory
Product: [Tools] Target Management Reporter: David McKnight <dmcknigh>
Component: RSEAssignee: David McKnight <dmcknigh>
Status: RESOLVED FIXED QA Contact: Martin Oberhuber <mober.at+eclipse>
Severity: normal    
Priority: P3 CC: xuanchen
Version: 3.1Flags: xuanchen: review+
Target Milestone: 3.4 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 358888, 358932    
Attachments:
Description Flags
patch to read and write file in segments during conversion
none
updated patch
none
updated patch to fix rename problem none

Description David McKnight CLA 2009-06-16 10:29:03 EDT
When converting files, the entire file is read into memory before the conversion and it would probably be better to use streams with a limited buffer size.
Comment 1 David McKnight CLA 2011-02-25 09:30:06 EST
Created attachment 189805 [details]
patch to read and write file in segments during conversion
Comment 2 David McKnight CLA 2011-02-25 09:31:16 EST
I've committed the change to cvs.
Comment 3 David McKnight CLA 2011-09-26 09:33:09 EDT
I've opened bug 280453 for backporting to RSE 3.0.x.
Comment 4 David McKnight CLA 2011-10-06 09:47:48 EDT
(In reply to comment #3)
> I've opened bug 280453 for backporting to RSE 3.0.x.

Correction, I opened bug 358888 for the 3.0.x backport.
Comment 5 David McKnight CLA 2011-11-04 11:21:20 EDT
Xuan, could you please review this patch?
Comment 6 Xuan Chen CLA 2011-11-14 11:42:13 EST
Just something minor.  It seems for two parts of the if statement, the conversion code is the same.  I am wondering if you want to move it into a  method.  Thanks.
Comment 7 David McKnight CLA 2011-11-14 12:38:08 EST
Created attachment 206967 [details]
updated patch

Xuan, how about this updated patch?
Comment 8 Xuan Chen CLA 2011-11-14 13:54:50 EST
The fix looks good. Thanks.
Comment 9 David McKnight CLA 2011-11-14 14:53:47 EST
I've updated the HEAD stream with the update.
Comment 10 David McKnight CLA 2012-03-20 15:21:04 EDT
Reopening this because the call to:

altFile.renameTo(file);

is problemmatic.  java.io.File.renameTo() doesn't work when the file already exists.
Comment 11 David McKnight CLA 2012-03-20 15:27:32 EDT
Created attachment 212941 [details]
updated patch to fix rename problem
Comment 12 David McKnight CLA 2012-03-20 15:28:26 EDT
I've committed the fix to the HEAD stream.
Comment 13 Martin Oberhuber CLA 2012-05-07 14:25:10 EDT
I guess the target milestone was meant to be 3.4 M6 , not 3.3 M6.