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

Bug 337447

Summary: Optimize calls to TRACER in BufferOutputStream
Product: [Modeling] EMF Reporter: Egidijus Vaisnora <vaisegid>
Component: cdo.coreAssignee: Egidijus Vaisnora <vaisegid>
Status: CLOSED FIXED QA Contact: Eike Stepper <stepper>
Severity: enhancement    
Priority: P3 Flags: stepper: review+
Version: 4.0   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
patch v1 none

Description Egidijus Vaisnora CLA 2011-02-17 10:10:37 EST
BufferOutputStream.write is intensivelly used method on data load. Our medel was comparing small with ~3500 node and this method was called 5.5 mln times during loading model. Any unecessarry call is undesired on such load.
Comment 1 Egidijus Vaisnora CLA 2011-02-17 10:16:39 EST
Created attachment 189193 [details]
patch v1
Comment 2 Eike Stepper CLA 2011-02-22 07:07:13 EST
Have you measured then performance gain? This way or that way I'm fine with your changes.

Maybe we want to make ensureBuffer() private so that the compiler has a chance to inline it? Similarly there's inlining potential by making the public flush() method call a new private method which is then also called by flushIfFilled().

If all this helps you may want to look at BufferInputStream, too...
Comment 3 Egidijus Vaisnora CLA 2011-02-22 16:00:10 EST
Method took about 12% of total call time (was visible after applying 337397 patch). Not such big overhead, but fix by itself is trivial. Added fix to the BufferInputStream too. However with your suggestion about inline I am not sure. I left it untouch.

fixed in trunk, revision 7177
Comment 4 Eike Stepper CLA 2011-02-23 01:57:15 EST
Committed revision 7183:
- trunk/plugins/org.eclipse.net4j
Comment 5 Eike Stepper CLA 2011-06-23 03:38:14 EDT
Available in R20110608-1407