Java deserialization speed
        Posted  
        
            by celicni
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by celicni
        
        
        
        Published on 2010-05-16T20:56:38Z
        Indexed on 
            2010/05/16
            21:00 UTC
        
        
        Read the original article
        Hit count: 163
        
I am writing a Java application that among other things needs to read a dictionary text file (each line is one word) and store it in a HashSet. Each time I start the application this same file is being read all over again (6 Megabytes unicode file).
That seemed expensive, so I decided to serialize resulting HashSet and store it to a binary file. I expected my application to run faster after this. Instead it got slower: from ~2,5 seconds before to ~5 seconds after serialization.
Is this expected result? I thought that in similar cases serialization should increase speed.
© Stack Overflow or respective owner