Esempio n. 1
0
        public void Performance_FullIJsonSerialize_Single()
        {
            Console.WriteLine("Time To Beat: 00:00:00.0230013");
            var content    = File.ReadAllText("Associates.json");
            var serializer = new JsonSerializer();

            JsonSerializationAbstractionMap.MapGeneric(typeof(IEnumerable <>), typeof(List <>));
            var start = DateTime.Now;
            var json  = JsonValue.Parse(content);
            var obj   = serializer.Deserialize <IEnumerable <SerializableAssociate> >(json);
            var end   = DateTime.Now;

            Console.WriteLine("Manatee: {0}", end - start);
            foreach (var serializableAssociate in obj)
            {
                Console.WriteLine("\t{0}", serializableAssociate);
            }
            start = DateTime.Now;
            var obj2 = JsonConvert.DeserializeObject <IEnumerable <SerializableAssociate> >(content);

            end = DateTime.Now;
            Console.WriteLine("NewtonSoft: {0}", end - start);
            foreach (var serializableAssociate in obj2)
            {
                Console.WriteLine("\t{0}", serializableAssociate);
            }
        }
Esempio n. 2
0
        public void Performance_FullIJsonSerialize_10000()
        {
            Console.WriteLine("Time To Beat: 00:00:00.6080608");
            var content    = File.ReadAllText("Associates.json");
            var serializer = new JsonSerializer();

            JsonSerializationAbstractionMap.MapGeneric(typeof(IEnumerable <>), typeof(List <>));
            IEnumerable <SerializableAssociate> obj;
            var start = DateTime.Now;

            for (int i = 0; i < 10000; i++)
            {
                var json = JsonValue.Parse(content);
                obj = serializer.Deserialize <IEnumerable <SerializableAssociate> >(json);
            }
            var end = DateTime.Now;

            Console.WriteLine("Manatee: {0}", end - start);
            start = DateTime.Now;
            for (int i = 0; i < 10000; i++)
            {
                obj = JsonConvert.DeserializeObject <IEnumerable <SerializableAssociate> >(content);
            }
            end = DateTime.Now;
            Console.WriteLine("NewtonSoft: {0}", end - start);
        }
Esempio n. 3
0
        public void Performance_IJsonSerializeOnly_Single()
        {
            Console.WriteLine("Time To Beat: 00:00:00.0120012");
            var content    = File.ReadAllText("Associates.json");
            var serializer = new JsonSerializer();

            JsonSerializationAbstractionMap.MapGeneric(typeof(IEnumerable <>), typeof(List <>));
            IEnumerable <SerializableAssociate> obj;
            var json  = JsonValue.Parse(content);
            var start = DateTime.Now;

            obj = serializer.Deserialize <IEnumerable <SerializableAssociate> >(json);
            var end = DateTime.Now;

            Console.WriteLine("Manatee: {0}", end - start);
        }
Esempio n. 4
0
 private static void InitializeAbstractionMap()
 {
     JsonSerializationAbstractionMap.Map <IJsonAction, ManateeAction>();
     JsonSerializationAbstractionMap.Map <IJsonActionData, ManateeActionData>();
     JsonSerializationAbstractionMap.Map <IJsonActionOldData, ManateeActionOldData>();
     JsonSerializationAbstractionMap.Map <IJsonAttachment, ManateeAttachment>();
     JsonSerializationAbstractionMap.Map <IJsonBadges, ManateeBadges>();
     JsonSerializationAbstractionMap.Map <IJsonBoard, ManateeBoard>();
     JsonSerializationAbstractionMap.Map <IJsonBoardBackground, ManateeBoardBackground>();
     JsonSerializationAbstractionMap.Map <IJsonBoardMembership, ManateeBoardMembership>();
     JsonSerializationAbstractionMap.Map <IJsonBoardPersonalPreferences, ManateeBoardPersonalPreferences>();
     JsonSerializationAbstractionMap.Map <IJsonBoardPreferences, ManateeBoardPreferences>();
     JsonSerializationAbstractionMap.Map <IJsonBoardVisibilityRestrict, ManateeBoardVisibilityRestrict>();
     JsonSerializationAbstractionMap.Map <IJsonCard, ManateeCard>();
     JsonSerializationAbstractionMap.Map <IJsonCheckItem, ManateeCheckItem>();
     JsonSerializationAbstractionMap.Map <IJsonCheckList, ManateeCheckList>();
     JsonSerializationAbstractionMap.Map <IJsonComment, ManateeComment>();
     JsonSerializationAbstractionMap.Map <IJsonImagePreview, ManateeImagePreview>();
     JsonSerializationAbstractionMap.Map <IJsonLabel, ManateeLabel>();
     JsonSerializationAbstractionMap.Map <IJsonList, ManateeList>();
     JsonSerializationAbstractionMap.Map <IJsonMember, ManateeMember>();
     JsonSerializationAbstractionMap.Map <IJsonMemberSearch, ManateeMemberSearch>();
     JsonSerializationAbstractionMap.Map <IJsonMemberSession, ManateeMemberSession>();
     JsonSerializationAbstractionMap.Map <IJsonMemberPreferences, ManateeMemberPreferences>();
     JsonSerializationAbstractionMap.Map <IJsonNotification, ManateeNotification>();
     JsonSerializationAbstractionMap.Map <IJsonNotificationData, ManateeNotificationData>();
     JsonSerializationAbstractionMap.Map <IJsonNotificationOldData, ManateeNotificationOldData>();
     JsonSerializationAbstractionMap.Map <IJsonOrganization, ManateeOrganization>();
     JsonSerializationAbstractionMap.Map <IJsonOrganizationMembership, ManateeOrganizationMembership>();
     JsonSerializationAbstractionMap.Map <IJsonOrganizationPreferences, ManateeOrganizationPreferences>();
     JsonSerializationAbstractionMap.Map <IJsonParameter, ManateeParameter>();
     JsonSerializationAbstractionMap.Map <IJsonPosition, ManateePosition>();
     JsonSerializationAbstractionMap.Map <IJsonPowerUp, ManateePowerUp>();
     JsonSerializationAbstractionMap.Map <IJsonPowerUpData, ManateePowerUpData>();
     JsonSerializationAbstractionMap.Map <IJsonSearch, ManateeSearch>();
     JsonSerializationAbstractionMap.Map <IJsonSticker, ManateeSticker>();
     JsonSerializationAbstractionMap.Map <IJsonToken, ManateeToken>();
     JsonSerializationAbstractionMap.Map <IJsonTokenPermission, ManateeTokenPermission>();
     JsonSerializationAbstractionMap.Map <IJsonWebhook, ManateeWebhook>();
     JsonSerializationAbstractionMap.Map <IJsonWebhookNotification, ManateeWebhookNotification>();
 }