Click here to Skip to main content
14,268,298 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have c# console application and I want to save the content of dictionaries in a file or database.so I wanted to ask:
which is faster(serialize/deserialize)using serialization libraries like(fastjson) or (select/insert)from/into database?
Posted
Rate this:
Please Sign up or sign in to vote.

Solution 1

I guess (a local) database should be faster. However nothing prevents you comparing the actual performances by measuring them (with data compatible with your scenario).
   
Comments
Member 12127665 14-Dec-15 14:54pm
   
thank you. i'll try.
Rate this:
Please Sign up or sign in to vote.

Solution 2

I see you already asked Mehdi Gholam a question in the comment section of his article on fastJSON here; why not ask him about performance/memory-use also.

Although, I think that performance/memory-use will vary depending on the various Types you are serializing, the database you use, etc.

As Mehdi states in his article, fastJSON will handle Dictionaries; you might ask him if Types that contain instances of the same Type have any problems being serialized ... since you are using a tree-structure.

You might also evaluate WCF (DataContract, DataMember) for serializing; I have serialized tree-structures with WCF. I first serialized with WCF to a memory stream; then used Gzip to compress it, and saved the compressed code to disk. The resulting Gzip file was almost always less than half the size compared to saving the WCF serialized code as XML.
   
Comments
Member 12127665 14-Dec-15 14:53pm
   
thanks alot for your replies.
I don't asked Mehdi Gholam because last time he didn't reply to my question!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100