Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which one is better for performance? Using .properties file or .conf file in Java? [closed]

Tags:

java

In java,which one is better for performance: Using .properties file or .conf file to read the values from these files?

like image 816
santro Avatar asked Oct 25 '25 23:10

santro


2 Answers

No difference. In both cases open and read the file.

And your properties file is probably not more than a few hundreds of lines.

like image 120
Bozho Avatar answered Oct 28 '25 16:10

Bozho


  1. The filename extension doesn't make a difference at all, I guess you mean the usual Java Properties format and some (but which?) other common configuration format?

  2. All common text configuration file formats are probably similarly fast to parse. They are all quite similar, and small differences in languages usually make no difference as today's parsers are quite good.

  3. Even if there is a speed difference in parsing the configuration file, it won't make a difference for you, because (hopefully!) you will parse the file only once (e.g. at application startup) or rarely at least and then use the result over a longer period of time. So in total it won't make a difference.

  4. Performance is not everything! Choosing a file format should focus on facts like whether it supports everything you need and want, whether it is nicely readable by humans, whether there already exist parsers for it etc. If you then find out (by measuring!) that it is too slow, you can start optimizing it. But it won't help you to choose a file format which is fast to parse, if you find out in the end that it does not support what you need.

like image 26
Philipp Wendler Avatar answered Oct 28 '25 16:10

Philipp Wendler