Home / Class/ DateFormatter2Benchmark Class — netty Architecture

DateFormatter2Benchmark Class — netty Architecture

Architecture documentation for the DateFormatter2Benchmark class in DateFormatter2Benchmark.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  505e0f8e_b661_805e_ffc6_ce92b493399d["DateFormatter2Benchmark"]
  e2fb11a3_c324_33b0_3078_741095e9556a["DateFormatter2Benchmark.java"]
  505e0f8e_b661_805e_ffc6_ce92b493399d -->|defined in| e2fb11a3_c324_33b0_3078_741095e9556a
  75cae9f6_81eb_4274_dff0_62f97d82633f["Date()"]
  505e0f8e_b661_805e_ffc6_ce92b493399d -->|method| 75cae9f6_81eb_4274_dff0_62f97d82633f

Relationship Graph

Source Code

microbench/src/main/java/io/netty/handler/codec/DateFormatter2Benchmark.java lines 27–95

@Threads(1)
@Warmup(iterations = 5)
@Measurement(iterations = 5)
public class DateFormatter2Benchmark extends AbstractMicrobenchmark {

    @Param({"Sun, 27 Jan 2016 19:18:46 GMT", "Sun, 27 Dec 2016 19:18:46 GMT"})
    String DATE_STRING;

    @Benchmark
    public Date parseHttpHeaderDateFormatterNew() {
        return DateFormatter.parseHttpDate(DATE_STRING);
    }

    /*
    @Benchmark
    public Date parseHttpHeaderDateFormatter() {
        return DateFormatterOld.parseHttpDate(DATE_STRING);
    }
    */

    /*
     * Benchmark                        (DATE_STRING)   Mode  Cnt        Score       Error  Units
     * parseHttpHeaderDateFormatter     Sun, 27 Jan 2016 19:18:46 GMT  thrpt    6  4142781.221 ± 82155.002  ops/s
     * parseHttpHeaderDateFormatter     Sun, 27 Dec 2016 19:18:46 GMT  thrpt    6  3781810.558 ± 38679.061  ops/s
     * parseHttpHeaderDateFormatterNew  Sun, 27 Jan 2016 19:18:46 GMT  thrpt    6  4372569.705 ± 30257.537  ops/s
     * parseHttpHeaderDateFormatterNew  Sun, 27 Dec 2016 19:18:46 GMT  thrpt    6  4339785.100 ± 57542.660  ops/s
     */

    /*Old DateFormatter.tryParseMonth method:
    private boolean tryParseMonth(CharSequence txt, int tokenStart, int tokenEnd) {
        int len = tokenEnd - tokenStart;

        if (len != 3) {
            return false;
        }

        if (matchMonth("Jan", txt, tokenStart)) {
            month = Calendar.JANUARY;
        } else if (matchMonth("Feb", txt, tokenStart)) {
            month = Calendar.FEBRUARY;
        } else if (matchMonth("Mar", txt, tokenStart)) {
            month = Calendar.MARCH;
        } else if (matchMonth("Apr", txt, tokenStart)) {
            month = Calendar.APRIL;
        } else if (matchMonth("May", txt, tokenStart)) {
            month = Calendar.MAY;
        } else if (matchMonth("Jun", txt, tokenStart)) {
            month = Calendar.JUNE;
        } else if (matchMonth("Jul", txt, tokenStart)) {
            month = Calendar.JULY;
        } else if (matchMonth("Aug", txt, tokenStart)) {
            month = Calendar.AUGUST;
        } else if (matchMonth("Sep", txt, tokenStart)) {
            month = Calendar.SEPTEMBER;
        } else if (matchMonth("Oct", txt, tokenStart)) {
            month = Calendar.OCTOBER;
        } else if (matchMonth("Nov", txt, tokenStart)) {
            month = Calendar.NOVEMBER;
        } else if (matchMonth("Dec", txt, tokenStart)) {
            month = Calendar.DECEMBER;
        } else {
            return false;
        }

        return true;
    }
    */

}

Frequently Asked Questions

What is the DateFormatter2Benchmark class?
DateFormatter2Benchmark is a class in the netty codebase, defined in microbench/src/main/java/io/netty/handler/codec/DateFormatter2Benchmark.java.
Where is DateFormatter2Benchmark defined?
DateFormatter2Benchmark is defined in microbench/src/main/java/io/netty/handler/codec/DateFormatter2Benchmark.java at line 27.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free