com.google.caliper.Benchmark Java Examples
The following examples show how to use
com.google.caliper.Benchmark.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExceptionWrappingBenchmark.java From mug with Apache License 2.0 | 5 votes |
@Benchmark void maybeGet(int n) { IOException exception = new IOException(); for (int i = 0; i < n; i++) { try { Maybe.except(exception).orElseThrow(); throw new AssertionError(); } catch (IOException expected) {} } }
Example #2
Source File: CacheBenchmark.java From buck with Apache License 2.0 | 5 votes |
@Benchmark public void invalidateEntries() { leaves.forEach( leaf -> cache.onFileSystemChange( WatchmanPathEvent.of( AbsPath.of(projectFilesystem.resolve(leaf)), Kind.CREATE, RelPath.of(Paths.get(leaf))))); }
Example #3
Source File: SQLiteArtifactCacheBenchmark.java From buck with Apache License 2.0 | 5 votes |
@Benchmark private void benchArtifactStore() { for (int i = 0; i < contentInfo.size() / 2; i++) { artifactCache.store(contentInfo.get(i), BorrowablePath.notBorrowablePath(inlinedFile)); } for (int i = contentInfo.size() / 2; i < contentInfo.size(); i++) { artifactCache.store(contentInfo.get(i), BorrowablePath.notBorrowablePath(largeFile)); } }
Example #4
Source File: ParserBenchmark.java From buck with Apache License 2.0 | 5 votes |
@Benchmark public void parseMultipleTargets() throws Exception { parser.buildTargetGraphWithTopLevelConfigurationTargets( ParsingContext.builder(cell.getRootCell(), executorService) .setSpeculativeParsing(SpeculativeParsing.ENABLED) .build(), ImmutableList.of( TargetNodePredicateSpec.of( BuildFileSpec.fromRecursivePath( CellRelativePath.of( cell.getRootCell().getCanonicalName(), ForwardRelativePath.of(""))))), Optional.empty()); }
Example #5
Source File: AutoProfilerBenchmark.java From bazel with Apache License 2.0 | 5 votes |
@Benchmark void profiledManually(int reps) { for (int i = 0; i < reps; i++) { long startTime = Profiler.nanoTimeMaybe(); Profiler.instance().logSimpleTask(startTime, profilerTaskType, "description"); } }
Example #6
Source File: CaliperObjectBenchmark.java From rhino-android with Apache License 2.0 | 5 votes |
@Benchmark @SuppressWarnings("unused") void deleteFields(int count) { Function create = (Function)ScriptableObject.getProperty(scope, "createObject"); Object o = create.call(cx, scope, null, new Object[]{1, strings, ints}); Function delete = (Function)ScriptableObject.getProperty(scope, "deleteObject"); delete.call(cx, scope, null, new Object[] {count, o, strings, ints}); }
Example #7
Source File: CaliperObjectBenchmark.java From rhino-android with Apache License 2.0 | 5 votes |
@Benchmark @SuppressWarnings("unused") void ownKeysFields(long count) { Function create = (Function)ScriptableObject.getProperty(scope, "createObject"); Object o = create.call(cx, scope, null, new Object[]{1, strings, ints}); Function iterate = (Function)ScriptableObject.getProperty(scope, "iterateOwnKeysObject"); iterate.call(cx, scope, null, new Object[] {count, o}); }
Example #8
Source File: CaliperObjectBenchmark.java From rhino-android with Apache License 2.0 | 5 votes |
@Benchmark @SuppressWarnings("unused") void iterateFields(long count) { Function create = (Function)ScriptableObject.getProperty(scope, "createObject"); Object o = create.call(cx, scope, null, new Object[]{1, strings, ints}); Function iterate = (Function)ScriptableObject.getProperty(scope, "iterateObject"); iterate.call(cx, scope, null, new Object[] {count, o}); }
Example #9
Source File: CaliperObjectBenchmark.java From rhino-android with Apache License 2.0 | 5 votes |
@Benchmark @SuppressWarnings("unused") void accessFields(int count) { Function create = (Function)ScriptableObject.getProperty(scope, "createObject"); Object o = create.call(cx, scope, null, new Object[]{1, strings, ints}); Function access = (Function)ScriptableObject.getProperty(scope, "accessObject"); access.call(cx, scope, null, new Object[] {count, o, strings, ints}); }
Example #10
Source File: CaliperObjectBenchmark.java From rhino-android with Apache License 2.0 | 5 votes |
@Benchmark @SuppressWarnings("unused") void createFields(int count) { Function create = (Function)ScriptableObject.getProperty(scope, "createObject"); create.call(cx, scope, null, new Object[]{count, strings, ints}); }
Example #11
Source File: ExceptionWrappingBenchmark.java From mug with Apache License 2.0 | 5 votes |
@Benchmark void noWrapper(int n) { IOException exception = new IOException(); for (int i = 0; i < n; i++) { try { Maybe.except(exception).orElseThrow(e -> e); throw new AssertionError(); } catch (IOException expected) {} } }
Example #12
Source File: ExceptionWrappingBenchmark.java From mug with Apache License 2.0 | 5 votes |
@Benchmark void manualWrapper(int n) { IOException exception = new IOException(); for (int i = 0; i < n; i++) { try { Maybe.except(exception).orElseThrow(IOException::new); throw new AssertionError(); } catch (IOException expected) {} } }
Example #13
Source File: ExceptionWrappingBenchmark.java From mug with Apache License 2.0 | 5 votes |
@Benchmark void reserializeString(int n) { String string = new String("abc"); for (int i = 0; i < n; i++) { SerializableTester.reserialize(string); } }
Example #14
Source File: ExceptionWrappingBenchmark.java From mug with Apache License 2.0 | 5 votes |
@Benchmark void reserializeException(int n) { IOException exception = new IOException(); for (int i = 0; i < n; i++) { SerializableTester.reserialize(exception); } }
Example #15
Source File: ExceptionWrappingBenchmark.java From mug with Apache License 2.0 | 5 votes |
@Benchmark void futuresGetChecked(int n) { IOException exception = new IOException(); CompletableFuture<?> future = new CompletableFuture<>(); future.completeExceptionally(exception); for (int i = 0; i < n; i++) { try { Futures.getChecked(future, IOException.class); throw new AssertionError(); } catch (IOException expected) {} } }
Example #16
Source File: XmlParsingBenchmark.java From tikxml with Apache License 2.0 | 4 votes |
@Benchmark public void jackson_InputSmall() throws Exception { new JacksonSmallXmlBenchmark().parse(xmlSmall); }
Example #17
Source File: XmlParsingBenchmark.java From tikxml with Apache License 2.0 | 4 votes |
@Benchmark public void tikxml_InputSmall() throws Exception { new TikXmlSmallXmlBenchmark().parse(xmlSmall); }
Example #18
Source File: XmlParsingBenchmark.java From tikxml with Apache License 2.0 | 4 votes |
@Benchmark public void simpleframework_InputSmall() throws Exception { new SimpleFrameworkSmallXmlBenchmark().parse(xmlSmall); }
Example #19
Source File: AutoProfilerBenchmark.java From bazel with Apache License 2.0 | 4 votes |
@Benchmark void profiledWithAutoProfiler(int reps) { for (int i = 0; i < reps; i++) { try (AutoProfiler p = AutoProfiler.profiled("profiling", profilerTaskType)) {} } }
Example #20
Source File: CaliperRunner.java From minimal-json with MIT License | 4 votes |
public CaliperRunner(Class<? extends Benchmark> benchmark) { this.benchmark = benchmark; this.resultsFile = getResultsFile(); }
Example #21
Source File: SQLiteArtifactCacheBenchmark.java From buck with Apache License 2.0 | 4 votes |
@Benchmark private void benchMetadataStore() { for (ArtifactInfo info : metadataInfo) { artifactCache.store(info, BorrowablePath.notBorrowablePath(emptyFile)); } }
Example #22
Source File: SQLiteArtifactCacheBenchmark.java From buck with Apache License 2.0 | 4 votes |
@Benchmark private void benchMetadataFetch() { for (RuleKey key : ruleKeys) { Futures.getUnchecked(artifactCache.fetchAsync(null, key, output)); } }
Example #23
Source File: SQLiteArtifactCacheBenchmark.java From buck with Apache License 2.0 | 4 votes |
@Benchmark private void benchArtifactFetch() { for (RuleKey key : ruleKeys) { Futures.getUnchecked(artifactCache.fetchAsync(null, key, output)); } }
Example #24
Source File: CacheBenchmark.java From buck with Apache License 2.0 | 4 votes |
@Benchmark public void addMultipleEntries() { addEntries(); }