All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.postgresql.benchmark.escaping.EscapeProcessing Maven / Gradle / Ivy

There is a newer version: 42.2.2
Show newest version
/*
 * Copyright (c) 2004, PostgreSQL Global Development Group
 * See the LICENSE file in the project root for more information.
 */

package org.postgresql.benchmark.escaping;

import org.postgresql.core.Parser;

import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Threads;
import org.openjdk.jmh.annotations.Warmup;

import java.util.concurrent.TimeUnit;

@Measurement(iterations = 10, time = 1, timeUnit = TimeUnit.SECONDS)
@Warmup(iterations = 10, time = 1, timeUnit = TimeUnit.SECONDS)
@State(Scope.Thread)
@Threads(1)
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public class EscapeProcessing {

  private String fnEscapeSQL = "{fn week({d '2005-01-24'})}";
  private boolean replaceProcessingEnabled = true;
  private boolean standardConformingStrings = false;

  @Benchmark
  public String escapeFunctionWithDate() throws Exception {
    return Parser.replaceProcessing(fnEscapeSQL, replaceProcessingEnabled, standardConformingStrings);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy