which is faster when application is running in java? -
which is faster when application is running in java? -
which faster when application running in java?
this:
static void readprice(string dir) throws exception{ /*make url , connection*/ url url = new url(dir + "/prices/all/"); httpurlconnection connection; /*start connection*/ connection = (httpurlconnection) url.openconnection(); /*send user-agent*/ connection.setrequestproperty("user-agent", user_agent); /*get http response*/ inputstream = connection.getinputstream(); bufferedreader rd = new bufferedreader(new inputstreamreader(is)); string line = rd.readline(); strjson = line; /*read prices json*/ pricesjson( strjson ); }
or this:
static void readprice(string dir) throws exception{ /*connection url */ connection = (httpurlconnection) new url( dir + "/prices/all/").openconnection(); /*send user-agent*/ connection.setrequestproperty("user-agent", user_agent); /*read prices json*/ pricesjson( new bufferedreader(new inputstreamreader( connection.getinputstream())).readline() ); }
i need application , smoothly, because has create requests server in real time
you don't check yourself?
just add together 2 timestamps @ begining , end of code , calculate time difference (in milliseconds). then, can check, code executes in shortest time , if there important difference.
//place @ origin of code long starttime = system.currenttimemillis(); //place @ end of code long endtime = system.currenttimemillis(); system.out.println(" execution time: " + (starttime-endtime));
java
Comments
Post a Comment