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

Side by Side Diff: source/test/perf/utfperf/utfperf.cpp

Issue 845603002: Update ICU to 54.1 step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@master
Patch Set: remove unusued directories Created 5 years, 11 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 | « source/test/perf/unisetperf/unisetperf.cpp ('k') | source/test/perf/utrie2perf/utrie2perf.bat » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 ********************************************************************** 2 **********************************************************************
3 * Copyright (C) 2002-2007, International Business Machines 3 * Copyright (C) 2002-2014, International Business Machines
4 * Corporation and others. All Rights Reserved. 4 * Corporation and others. All Rights Reserved.
5 ********************************************************************** 5 **********************************************************************
6 * file name: utfperf.cpp 6 * file name: utfperf.cpp
7 * encoding: US-ASCII 7 * encoding: US-ASCII
8 * tab size: 8 (not used) 8 * tab size: 8 (not used)
9 * indentation:4 9 * indentation:4
10 * 10 *
11 * created on: 2005Nov17 11 * created on: 2005Nov17
12 * created by: Raymond Yang 12 * created by: Raymond Yang
13 * 13 *
14 * Ported from utfper.c created by Markus W. Scherer 14 * Ported from utfper.c created by Markus W. Scherer
15 * Performance test program for Unicode converters 15 * Performance test program for Unicode converters
16 */ 16 */
17 17
18 #include <stdio.h> 18 #include <stdio.h>
19 #include <stdlib.h> 19 #include <stdlib.h>
20 #include "unicode/uperf.h" 20 #include "unicode/uperf.h"
21 #include "cmemory.h" // for UPRV_LENGTHOF
21 #include "uoptions.h" 22 #include "uoptions.h"
22 23
23 #define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
24
25 /* definitions and text buffers */ 24 /* definitions and text buffers */
26 25
27 #define INPUT_CAPACITY (1024*1024) 26 #define INPUT_CAPACITY (1024*1024)
28 #define INTERMEDIATE_CAPACITY 4096 27 #define INTERMEDIATE_CAPACITY 4096
29 #define INTERMEDIATE_SMALL_CAPACITY 20 28 #define INTERMEDIATE_SMALL_CAPACITY 20
30 #define PIVOT_CAPACITY 1024 29 #define PIVOT_CAPACITY 1024
31 #define OUTPUT_CAPACITY INPUT_CAPACITY 30 #define OUTPUT_CAPACITY INPUT_CAPACITY
32 31
33 static char utf8[INPUT_CAPACITY]; 32 static char utf8[INPUT_CAPACITY];
34 static UChar pivot[INTERMEDIATE_CAPACITY]; 33 static UChar pivot[INTERMEDIATE_CAPACITY];
(...skipping 25 matching lines...) Expand all
60 "\t--charset Charset for which to test performance, e.g. windows-1251.\n" 59 "\t--charset Charset for which to test performance, e.g. windows-1251.\n"
61 "\t Default: UTF-8\n" 60 "\t Default: UTF-8\n"
62 "\t--chunk Length (in bytes) of charset output chunks. [4096]\n" 61 "\t--chunk Length (in bytes) of charset output chunks. [4096]\n"
63 "\t--pivot Length (in UChars) of the UTF-16 pivot buffer, if applicable. \n" 62 "\t--pivot Length (in UChars) of the UTF-16 pivot buffer, if applicable. \n"
64 "\t [1024]\n"; 63 "\t [1024]\n";
65 64
66 // Test object. 65 // Test object.
67 class UtfPerformanceTest : public UPerfTest{ 66 class UtfPerformanceTest : public UPerfTest{
68 public: 67 public:
69 UtfPerformanceTest(int32_t argc, const char *argv[], UErrorCode &status) 68 UtfPerformanceTest(int32_t argc, const char *argv[], UErrorCode &status)
70 : UPerfTest(argc, argv, options, LENGTHOF(options), utfperf_usage, s tatus) { 69 : UPerfTest(argc, argv, options, UPRV_LENGTHOF(options), utfperf_usa ge, status) {
71 if (U_SUCCESS(status)) { 70 if (U_SUCCESS(status)) {
72 charset = options[CHARSET].value; 71 charset = options[CHARSET].value;
73 72
74 chunkLength = atoi(options[CHUNK_LENGTH].value); 73 chunkLength = atoi(options[CHUNK_LENGTH].value);
75 if (chunkLength < 1 || OUTPUT_CAPACITY < chunkLength) { 74 if (chunkLength < 1 || OUTPUT_CAPACITY < chunkLength) {
76 fprintf(stderr, "error: chunk length must be 1..%ld\n", (long)OU TPUT_CAPACITY); 75 fprintf(stderr, "error: chunk length must be 1..%ld\n", (long)OU TPUT_CAPACITY);
77 status = U_ILLEGAL_ARGUMENT_ERROR; 76 status = U_ILLEGAL_ARGUMENT_ERROR;
78 } 77 }
79 78
80 pivotLength = atoi(options[PIVOT_LENGTH].value); 79 pivotLength = atoi(options[PIVOT_LENGTH].value);
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 "arguments.\n"); 355 "arguments.\n");
357 return -1; 356 return -1;
358 } 357 }
359 358
360 if (fromUCallbackCount > 0) { 359 if (fromUCallbackCount > 0) {
361 printf("Number of fromUnicode callback calls in the last iteration: %ld\ n", (long)fromUCallbackCount); 360 printf("Number of fromUnicode callback calls in the last iteration: %ld\ n", (long)fromUCallbackCount);
362 } 361 }
363 362
364 return 0; 363 return 0;
365 } 364 }
OLDNEW
« no previous file with comments | « source/test/perf/unisetperf/unisetperf.cpp ('k') | source/test/perf/utrie2perf/utrie2perf.bat » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698