Search in sources :

Example 1 with TimeInterval

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);
}
Also used : TimeInterval(cn.hutool.core.date.TimeInterval) HttpResponse(cn.hutool.http.HttpResponse) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 2 with TimeInterval

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);
}
Also used : TimeInterval(cn.hutool.core.date.TimeInterval) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 3 with TimeInterval

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);
}
Also used : TimeInterval(cn.hutool.core.date.TimeInterval) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 4 with TimeInterval

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());
}
Also used : TimeInterval(cn.hutool.core.date.TimeInterval) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 5 with TimeInterval

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());
}
Also used : TimeInterval(cn.hutool.core.date.TimeInterval) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

TimeInterval (cn.hutool.core.date.TimeInterval)18 Test (org.junit.Test)14 Ignore (org.junit.Ignore)12 HttpResponse (cn.hutool.http.HttpResponse)2 DateTime (cn.hutool.core.date.DateTime)1 Month (cn.hutool.core.date.Month)1 Quarter (cn.hutool.core.date.Quarter)1 JSONObject (com.alibaba.fastjson.JSONObject)1 ExceptionNoticeResponse (com.hccake.ballcat.autoconfigure.web.exception.domain.ExceptionNoticeResponse)1 Date (java.util.Date)1 BoundSql (org.apache.ibatis.mapping.BoundSql)1 MappedStatement (org.apache.ibatis.mapping.MappedStatement)1 MetaObject (org.apache.ibatis.reflection.MetaObject)1 Configuration (org.apache.ibatis.session.Configuration)1