[ 
https://issues.apache.org/jira/browse/IGNITE-1779?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14976285#comment-14976285
 ] 

Pavel  Tupitsyn edited comment on IGNITE-1779 at 10/27/15 12:40 PM:
--------------------------------------------------------------------

{code:title=PortableSelfTest.cs}
        [Test]
        public void TestArraySerializable()
        {
            var serArr = Enumerable.Range(1, 10000).Select(x => new 
SerializableObject {Foo = x}).ToArray();
            var objArr = serArr.OfType<object>().ToArray();

            Console.WriteLine("As serializable: " + 
_marsh.Marshal(serArr).Length / serArr.Length);  // 18
            Console.WriteLine("As object array: " + 
_marsh.Marshal(objArr).Length / serArr.Length);  // 232
        }

        [Test]
        public void TestArrayWithRawPortables()
        {
            var marsh =
                new PortableMarshaller(new PortableConfiguration
                {
                    TypeConfigurations =
                        new List<PortableTypeConfiguration> { new 
PortableTypeConfiguration(typeof(PrimitiveFieldRawPortableType)) }
                });


            var serArr = Enumerable.Range(1, 1000).Select(x => new 
PrimitiveFieldRawPortableType { PDouble = x }).ToArray();
            var objArr = serArr.OfType<object>().ToArray();

            Console.WriteLine("As serializable: " + 
marsh.Marshal(serArr).Length / serArr.Length);  // 128
            Console.WriteLine("As object array: " + 
marsh.Marshal(objArr).Length / objArr.Length);  // 383
        }

{code}


was (Author: ptupitsyn):
{code:title=PortableSelfTest.cs}
        [Test]
        public void TestArraySerializable()
        {
            var serArr = Enumerable.Range(1, 10000).Select(x => new 
SerializableObject {Foo = x}).ToArray();
            var objArr = serArr.OfType<object>().ToArray();

            Console.WriteLine("As serializable: " + 
_marsh.Marshal(serArr).Length / serArr.Length);
            Console.WriteLine("As object array: " + 
_marsh.Marshal(objArr).Length / serArr.Length);
        }
{code}

As serializable: 18
As object array: 232

> .Net: Evaluate BinaryFormatter overhead for generic collections.
> ----------------------------------------------------------------
>
>                 Key: IGNITE-1779
>                 URL: https://issues.apache.org/jira/browse/IGNITE-1779
>             Project: Ignite
>          Issue Type: Task
>          Components: interop
>    Affects Versions: ignite-1.4
>            Reporter: Vladimir Ozerov
>            Assignee: Pavel  Tupitsyn
>            Priority: Critical
>             Fix For: 1.5
>
>
> It seems that BinaryFormatter is extreeeemly inefficient. I tried to write a 
> single Guid with and it resulted in >100 bytes comparing to 16 bytes when 
> written in portable form. 
> If we notice the same overhead for collections/arrays which are fairly often 
> used types, we will have to revert to our initial approach when collections 
> were serialized using our own mechanics.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to