49282296b6
BUG=skia: Change-Id: I5a995b63b1a2975cce8101717777eaa6fc12af21 Reviewed-on: https://skia-review.googlesource.com/6035 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
42 lines
958 B
C++
42 lines
958 B
C++
/*
|
|
* Copyright 2016 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#include "Benchmark.h"
|
|
#include "SkStream.h"
|
|
|
|
class StreamBench : public Benchmark {
|
|
SkString fName;
|
|
public:
|
|
StreamBench() {
|
|
fName.printf("wstream");
|
|
}
|
|
|
|
bool isSuitableFor(Backend backend) override {
|
|
return backend == kNonRendering_Backend;
|
|
}
|
|
|
|
protected:
|
|
const char* onGetName() override { return fName.c_str(); }
|
|
|
|
void onDraw(int loops, SkCanvas* canvas) override {
|
|
for (int i = 0; i < loops*100; ++i) {
|
|
SkDynamicMemoryWStream stream;
|
|
for (int j = 0; j < 100000; ++j) {
|
|
stream.write32(j);
|
|
stream.write32(j+j);
|
|
}
|
|
}
|
|
}
|
|
|
|
private:
|
|
typedef Benchmark INHERITED;
|
|
};
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
DEF_BENCH(return new StreamBench;)
|