apache poi - How to reduce time in a Java execution program? -


i'm kind of new in theme, want reduce time in program execution, can not post of code politics client, try detailed can.

i have program on java , uses next libraries:

  1. pdfbox 1.8.2
  2. poi 3.7

and common ones, java util, io, regex, , swing.

the inputs are: 1. "mom pdf" file 2. excel original file

the outputs:

  1. childs pdf files
  2. an output excel information

this program takes information pdf file , put excel file. pdf file have hundreds of pages. program read "mom pdf" file search "the word" , if word in page creates "child pdf" file page, extracts information required, open excel file write down information extracted page, close excel file , close "child pdf". action repeats numbers of times regex finds "the word" in "mom pdf" .the program structured in 3 blocks.

  • the setting block . when prepare file directions , initialize them
  • the extraction block. when program reads pdf file , search information needed in excel file
  • the excel block. when program prints information extracted pdf excel file.

an attempt made shorter time, separate 3 blocks of code , have main class , calls there methods of blocks, worked @ first did not after few testing. time of execution takes long, want know if there way made shorter.

a previous version of program create scratch excel file information placed, need take input file because have specific format need followed. previous version faster.

thank much.

usually 1 piece of code causing of performance problems. in industry established practice remove 1 bottleneck before deciding whether next profiling iteration needed. save alot of trouble not guessing might sub optimal part of code , instead looking @ causing slowdown. people unable guess looking @ code. takes run visualvm (part of standard jdk) in sampler mode, making 1 snapshot , looking @ stack trace. after identified 1 method, laziest approach cache data (for example results of parsing child pdfs might stored in hashmap)


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -