Software configuration lab5

3.1 Static Program Analysis
Reading google norms, codes of Lab4 manual code review, make changes.
Watch named layout (blank lines, spaces, indents, branches, etc.), notes (java doc, RI, AF, safety from rep exposure, function spec, etc.), file / organization package.

Use CheckStyle and SpotBugs tools to artificially walkthrough Lab4 code automatic static code analysis. Still very happy

3.2 Java I / O Performance Optimization
add a new function: to write a new text file for persistent storage of data through a variety of CircularOrbit after manual operation.
It is not difficult, nor is it the first time this function

Using three different Java I / O strategy for your program file I / O improvements, observe the I / O efficiency differences
Reader / Writer
Scanner
BufferedReader / bufferwriter

To measure different implementations of experiments I / O performance differences:
increase in code, time for reading documents and write files collecting links are consumed, comparative analysis
when doing contrast, consider only I / O link is not considered in accordance with time to read into the data structure of the track objects
in different ways, the difference is still very large

3.3 Java Memory Management and Garbage Collection (GC)

Use -verbose: gc other parameters, or use jstat, jmap and other command-line tool for monitoring and analyzing
try to optimize the program's memory parameter settings

3.4 Dynamic Program Profiling

VisualVM start using the program, the program to read the file, and graphs generated for various operations

Select execution time performance CPU Profiling, dynamic monitoring program:
the methods executed by the program to see the time it takes proportion;

Selecting memory profiling, dynamic memory performance monitor program:
Check the number of objects of different types of memory space, the memory space occupied, the proportion of space occupied by the like;

3.5 Memory Dump Analysis and Performance Optimization

Let the program read large files
to export the current time HPROF file
using MAT to analyze the exported file
to use to query OQL

Experience:
Code "looks beautiful" and "up and running beautiful" are not in conflict, I prefer the latter
as such code SpotBugs and CheckStyle static analysis tools to improve code quality
Java provides the I / O to achieve so many way, in fact, reflects the gradual optimization process its own code of JDK
JVM automatic garbage collection, thus avoiding trouble programmer manual garbage collection, but there is room for improvement

Guess you like

Origin blog.csdn.net/weiaibeachsea/article/details/93406397