Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » XMI Resource to BinaryResourceImpl
XMI Resource to BinaryResourceImpl [message #902299] Thu, 16 August 2012 20:55 Go to next message
Karan Anand is currently offline Karan AnandFriend
Messages: 8
Registered: June 2012
Junior Member
Hi Everyone,

We are trying to migrate from XML based resources to Binary resources in our application (due to performance reasons).

In order to do so, there are 2 issues we are trying to get around:

1. We see considerable improvements in the save time and the file size, however, there is an increase in load times in case of Binary resources, which is unexpected.

Here are the stats:

XMI Resource loaded in 7244 ms
XMI Resource saved in 2493 ms
XMI File Size 86,359 KB (84.2 MB)
--------------------------------------------------
Binary Resource loaded in 8905 ms
Binary Resource saved in 862 ms
Binary File Size 24,842 KB (24.2 MB)

And this is how we are loading / saving the resources:

ResourceSet resourceSet = new MyResourceSetImpl();
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
				.put("binary", new Resource.Factory() {
					@Override
					public Resource createResource(URI uri) {
						return new BinaryResourceImpl(uri);
					}
				});
EObject model = ModelUtils.load(URI.createFileURI(sourceFileName), resourceSet);
Resource resource = model.eResource();
resource.save(null);


In the above code, MyResourceSetImpl has a default resource factory (for xml-files), and a custom factory (for binary-files). The resource are instantiated fine, with out any problems based on the type of the file. But we can't figure out the reason for the increase in load time.

What are we missing?

2. The other problem is that we are currently using UUID's to identify the objects. Since UUID's are string based, and binary files can't be "read", is there a suggested alternative to ID the instances in binary file format?

Thanks in advance!

- Karan Anand
Re: XMI Resource to BinaryResourceImpl [message #902320 is a reply to message #902299] Fri, 17 August 2012 04:44 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Karan,<br>
<br>
Which version of EMF are you using?  I know there were issues with
buffering on the input and output streams that caused things to be
slow; this was fixed in 2.7.  Also, XMLResource.OPTION_BINARY was
added so that an XMLResourceImpl can read or write binary, <b>and </b>can
load and save the extrinsic ID map so you don't loose the IDs you
get when you serialize XML/XMI.<br>
<br>
<br>
<div class="moz-cite-prefix">On 16/08/2012 10:55 PM, Karan Anand
wrote:<br>
</div>
<blockquote cite="mid:k0jmnk$a7b$1@xxxxxxxxe.org" type="cite">Hi
Everyone,
<br>
<br>
We are trying to migrate from XML based resources to Binary
resources in our application (due to performance reasons).
<br>
<br>
In order to do so, there are 2 issues we are trying to get around:
<br>
<br>
1. We see considerable improvements in the save time and the file
size, however, there is an increase in load times in case of
Binary resources, which is unexpected.
<br>
<br>
Here are the stats:
<br>
<br>
XMI Resource loaded in 7244 ms
<br>
XMI Resource saved in 2493 ms
<br>
XMI File Size 86,359 KB (84.2 MB)
<br>
--------------------------------------------------
<br>
Binary Resource loaded in 8905 ms
<br>
Binary Resource saved in 862 ms
<br>
Binary File Size 24,842 KB (24.2 MB)
<br>
<br>
And this is how we are loading / saving the resources:
<br>
<br>
<br>
ResourceSet resourceSet = new MyResourceSetImpl();
<br>
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
<br>
                .put("binary", new Resource.Factory() {
<br>
                    @Override
<br>
                    public Resource createResource(URI uri) {
<br>
                        return new BinaryResourceImpl(uri);
<br>
                    }
<br>
                });
<br>
EObject model = ModelUtils.load(URI.createFileURI(sourceFileName),
resourceSet);
<br>
Resource resource = model.eResource();
<br>
resource.save(null);
<br>
<br>
<br>
In the above code, MyResourceSetImpl has a default resource
factory (for xml-files), and a custom factory (for binary-files).
The resource are instantiated fine, with out any problems based on
the type of the file. But we can't figure out the reason for the
increase in load time.
<br>
<br>
What are we missing?
<br>
<br>
2. The other problem is that we are currently using UUID's to
identify the objects. Since UUID's are string based, and binary
files can't be "read", is there a suggested alternative to ID the
instances in binary file format?
<br>
<br>
Thanks in advance!
<br>
<br>
- Karan Anand
<br>
</blockquote>
<br>
</body>
</html>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: XMI Resource to BinaryResourceImpl [message #902431 is a reply to message #902320] Fri, 17 August 2012 14:42 Go to previous message
Karan Anand is currently offline Karan AnandFriend
Messages: 8
Registered: June 2012
Junior Member
Hi Ed,

Thanks for your message. We are on 2.6

Will try 2.7 and see how it goes.

Thanks again.

- Karan
Previous Topic:[EMF Validation] Support for Eclipse 3.8?
Next Topic:[CDO] Exception Handling on Commit
Goto Forum:
  


Current Time: Thu Mar 28 22:04:01 GMT 2024

Powered by FUDForum. Page generated in 0.04920 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top