Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(526)

Side by Side Diff: bench/ChecksumBench.cpp

Issue 1913173003: SkMD5: .update() -> .write() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-04-22 (Friday) 16:17:21 EDT Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/core/SkMD5.h » ('j') | src/core/SkMD5.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #include "Benchmark.h" 7 #include "Benchmark.h"
8 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkChecksum.h" 9 #include "SkChecksum.h"
10 #include "SkMD5.h" 10 #include "SkMD5.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 default: SK_ABORT("Invalid Type"); return ""; 45 default: SK_ABORT("Invalid Type"); return "";
46 } 46 }
47 } 47 }
48 48
49 void onDraw(int loops, SkCanvas*) override { 49 void onDraw(int loops, SkCanvas*) override {
50 switch (fType) { 50 switch (fType) {
51 case kMD5_ChecksumType: { 51 case kMD5_ChecksumType: {
52 for (int i = 0; i < loops; i++) { 52 for (int i = 0; i < loops; i++) {
53 SkMD5 md5; 53 SkMD5 md5;
54 md5.update(reinterpret_cast<uint8_t*>(fData), sizeof(fData)) ; 54 md5.write(fData, sizeof(fData));
55 SkMD5::Digest digest; 55 SkMD5::Digest digest;
56 md5.finish(digest); 56 md5.finish(digest);
57 } 57 }
58 } break; 58 } break;
59 case kMurmur3_ChecksumType: { 59 case kMurmur3_ChecksumType: {
60 for (int i = 0; i < loops; i++) { 60 for (int i = 0; i < loops; i++) {
61 volatile uint32_t result = SkChecksum::Murmur3(fData, sizeof (fData)); 61 volatile uint32_t result = SkChecksum::Murmur3(fData, sizeof (fData));
62 sk_ignore_unused_variable(result); 62 sk_ignore_unused_variable(result);
63 } 63 }
64 }break; 64 }break;
65 } 65 }
66 66
67 } 67 }
68 68
69 private: 69 private:
70 typedef Benchmark INHERITED; 70 typedef Benchmark INHERITED;
71 }; 71 };
72 72
73 /////////////////////////////////////////////////////////////////////////////// 73 ///////////////////////////////////////////////////////////////////////////////
74 74
75 DEF_BENCH( return new ComputeChecksumBench(kMD5_ChecksumType); ) 75 DEF_BENCH( return new ComputeChecksumBench(kMD5_ChecksumType); )
76 DEF_BENCH( return new ComputeChecksumBench(kMurmur3_ChecksumType); ) 76 DEF_BENCH( return new ComputeChecksumBench(kMurmur3_ChecksumType); )
OLDNEW
« no previous file with comments | « no previous file | src/core/SkMD5.h » ('j') | src/core/SkMD5.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698