This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
I really have two questions! 1- If you have a strut-config.xml that is lets say 4000 actions tags.(just for the sake of discussion) and that you only use 1000 of those actions tags. (Reason for only using 1000 is because of a merge in old an new project bla bla bla). So now, when we start the application, the Struts framework parses the struts-config.xml into classes, I suppose?? and loads it into memory. Right?? And the fact that you only use 1/4 of the action tags, the 3/4 that are loaded for nothing, will it impact performances??? And how dramatically will it impact performances if it does??? 2- I was told that Java introspection was not very performant. I was very supprised to hear that, but I dought my source. So I thought I would ask here. I'm sure that Java introspection for javaBeans loading either in plain java or Struts is finelly tuned, right ??
action mappings get put into a hash map. 4000 items in a hashmap is not a major drain on performance. reflection is pretty fast since JDK1.3. if i remember correctly it use to be 20x slower to invoke a method reflection than to invoke directly. since JDK1.3 it is only twice as slow. i guess that equates to 2 nano seconds vs. 1 nano second... not too much to worry about. if you are worried, write a test using JUnitPerf. call a method on the same object a few billion times using reflection and then directly... see which one is faster. in truth, it is dust on the scale compared to other things you could do to improve performance in a web app (data caching, page caching, etc.).