use of cn.hutool.core.date.TimeInterval in project hutool by looly.
the class HttpRequestTest method asyncGetTest.
@Test
@Ignore
public void asyncGetTest() {
TimeInterval timer = DateUtil.timer();
HttpResponse body = HttpRequest.get(url).charset("GBK").executeAsync();
long interval = timer.interval();
timer.restart();
Console.log(body.body());
long interval2 = timer.interval();
Console.log("Async response spend {}ms, body spend {}ms", interval, interval2);
}
use of cn.hutool.core.date.TimeInterval in project hutool by looly.
the class HttpRequestTest method syncGetTest.
@Test
@Ignore
public void syncGetTest() {
TimeInterval timer = DateUtil.timer();
HttpResponse body = HttpRequest.get(url).charset("GBK").execute();
long interval = timer.interval();
timer.restart();
Console.log(body.body());
long interval2 = timer.interval();
Console.log("Async response spend {}ms, body spend {}ms", interval, interval2);
}
use of cn.hutool.core.date.TimeInterval in project hutool by dromara.
the class HttpRequestTest method syncGetTest.
@Test
@Ignore
public void syncGetTest() {
TimeInterval timer = DateUtil.timer();
HttpResponse body = HttpRequest.get(url).charset("GBK").execute();
long interval = timer.interval();
timer.restart();
Console.log(body.body());
long interval2 = timer.interval();
Console.log("Async response spend {}ms, body spend {}ms", interval, interval2);
}
use of cn.hutool.core.date.TimeInterval in project hutool by dromara.
the class IdUtilTest method benchTest.
/**
* UUID的性能测试
*/
@Test
@Ignore
public void benchTest() {
TimeInterval timer = DateUtil.timer();
for (int i = 0; i < 1000000; i++) {
IdUtil.simpleUUID();
}
Console.log(timer.interval());
timer.restart();
for (int i = 0; i < 1000000; i++) {
// noinspection ResultOfMethodCallIgnored
UUID.randomUUID().toString().replace("-", "");
}
Console.log(timer.interval());
}
use of cn.hutool.core.date.TimeInterval in project hutool by dromara.
the class StrBuilderTest method benchTest.
/**
* StrBuilder的性能测试
*/
@Test
@Ignore
public void benchTest() {
TimeInterval timer = DateUtil.timer();
StrBuilder builder = StrBuilder.create();
for (int i = 0; i < 1000000; i++) {
builder.append("test");
builder.reset();
}
Console.log(timer.interval());
timer.restart();
StringBuilder b2 = new StringBuilder();
for (int i = 0; i < 1000000; i++) {
b2.append("test");
b2 = new StringBuilder();
}
Console.log(timer.interval());
}
Aggregations