Source Code Cross Referenced for UCharacterPerf.java in  » Internationalization-Localization » icu4j » com » ibm » icu » dev » test » perf » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Internationalization Localization » icu4j » com.ibm.icu.dev.test.perf 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         *******************************************************************************
003:         * Copyright (C) 2001-2004, International Business Machines Corporation and    *
004:         * others. All Rights Reserved.                                                *
005:         *******************************************************************************
006:         */package com.ibm.icu.dev.test.perf;
007:
008:        import com.ibm.icu.lang.UCharacter;
009:
010:        /**
011:         * Base performance test that takes in a method name for testing with JDK.
012:         * To use 
013:         * <code>
014:         * java com.ibm.icu.dev.test.perf.UCharacterPerf $MethodName $LoopCount - 
015:         *                                  $START_TEST_CHARACTER $END_TEST_CHARACTER
016:         * </code>
017:         * where $*_TEST_CHARACTER are in hex decimals with a leading 0x
018:         */
019:        public final class UCharacterPerf extends PerfTest {
020:            // public methods ------------------------------------------------------
021:
022:            public static void main(String[] args) throws Exception {
023:                new UCharacterPerf().run(args);
024:                // new UCharacterPerf().TestPerformance();
025:            }
026:
027:            protected void setup(String[] args) {
028:                // We only take one argument, the pattern
029:                MIN_ = Character.MIN_VALUE;
030:                MAX_ = Character.MAX_VALUE;
031:                if (args.length >= 1) {
032:                    MIN_ = Integer.parseInt(args[0], 16);
033:                }
034:                if (args.length >= 2) {
035:                    MAX_ = Integer.parseInt(args[1], 16);
036:                }
037:            }
038:
039:            PerfTest.Function testDigit() {
040:                return new PerfTest.Function() {
041:                    public void call() {
042:                        for (int ch = MIN_; ch < MAX_; ch++) {
043:                            UCharacter.digit(ch, 10);
044:                        }
045:                    }
046:
047:                    public long getOperationsPerIteration() {
048:                        return MAX_ - MIN_ + 1;
049:                    }
050:                };
051:            }
052:
053:            PerfTest.Function testJDKDigit() {
054:                return new PerfTest.Function() {
055:                    public void call() {
056:                        for (char ch = (char) MIN_; ch < (char) MAX_; ch++) {
057:                            Character.digit(ch, 10);
058:                        }
059:                    }
060:
061:                    public long getOperationsPerIteration() {
062:                        return MAX_ - MIN_ + 1;
063:                    }
064:                };
065:            }
066:
067:            PerfTest.Function testGetNumericValue() {
068:                return new PerfTest.Function() {
069:                    public void call() {
070:                        for (int ch = MIN_; ch < MAX_; ch++) {
071:                            UCharacter.getNumericValue(ch);
072:                        }
073:                    }
074:
075:                    public long getOperationsPerIteration() {
076:                        return MAX_ - MIN_ + 1;
077:                    }
078:                };
079:            }
080:
081:            PerfTest.Function testJDKGetNumericValue() {
082:                return new PerfTest.Function() {
083:                    public void call() {
084:                        for (char ch = (char) MIN_; ch < (char) MAX_; ch++) {
085:                            Character.getNumericValue(ch);
086:                        }
087:                    }
088:
089:                    public long getOperationsPerIteration() {
090:                        return MAX_ - MIN_ + 1;
091:                    }
092:                };
093:            }
094:
095:            PerfTest.Function testGetType() {
096:                return new PerfTest.Function() {
097:                    public void call() {
098:                        for (int ch = MIN_; ch < MAX_; ch++) {
099:                            UCharacter.getType(ch);
100:                        }
101:                    }
102:
103:                    public long getOperationsPerIteration() {
104:                        return MAX_ - MIN_ + 1;
105:                    }
106:                };
107:            }
108:
109:            PerfTest.Function testJDKGetType() {
110:                return new PerfTest.Function() {
111:                    public void call() {
112:                        for (char ch = (char) MIN_; ch < (char) MAX_; ch++) {
113:                            Character.getType(ch);
114:                        }
115:                    }
116:
117:                    public long getOperationsPerIteration() {
118:                        return MAX_ - MIN_ + 1;
119:                    }
120:                };
121:            }
122:
123:            PerfTest.Function testIsDefined() {
124:                return new PerfTest.Function() {
125:                    public void call() {
126:                        for (int ch = MIN_; ch < MAX_; ch++) {
127:                            UCharacter.isDefined(ch);
128:                        }
129:                    }
130:
131:                    public long getOperationsPerIteration() {
132:                        return MAX_ - MIN_ + 1;
133:                    }
134:                };
135:            }
136:
137:            PerfTest.Function testJDKIsDefined() {
138:                return new PerfTest.Function() {
139:                    public void call() {
140:                        for (char ch = (char) MIN_; ch < (char) MAX_; ch++) {
141:                            Character.isDefined(ch);
142:                        }
143:                    }
144:
145:                    public long getOperationsPerIteration() {
146:                        return MAX_ - MIN_ + 1;
147:                    }
148:                };
149:            }
150:
151:            PerfTest.Function testIsDigit() {
152:                return new PerfTest.Function() {
153:                    public void call() {
154:                        for (int ch = MIN_; ch < MAX_; ch++) {
155:                            UCharacter.isDigit(ch);
156:                        }
157:                    }
158:
159:                    public long getOperationsPerIteration() {
160:                        return MAX_ - MIN_ + 1;
161:                    }
162:                };
163:            }
164:
165:            PerfTest.Function testJDKIsDigit() {
166:                return new PerfTest.Function() {
167:                    public void call() {
168:                        for (char ch = (char) MIN_; ch < (char) MAX_; ch++) {
169:                            Character.isDigit(ch);
170:                        }
171:                    }
172:
173:                    public long getOperationsPerIteration() {
174:                        return MAX_ - MIN_ + 1;
175:                    }
176:                };
177:            }
178:
179:            PerfTest.Function testIsIdentifierIgnorable() {
180:                return new PerfTest.Function() {
181:                    public void call() {
182:                        for (int ch = MIN_; ch < MAX_; ch++) {
183:                            UCharacter.isIdentifierIgnorable(ch);
184:                        }
185:                    }
186:
187:                    public long getOperationsPerIteration() {
188:                        return MAX_ - MIN_ + 1;
189:                    }
190:                };
191:            }
192:
193:            PerfTest.Function testJDKIsIdentifierIgnorable() {
194:                return new PerfTest.Function() {
195:                    public void call() {
196:                        for (char ch = (char) MIN_; ch < (char) MAX_; ch++) {
197:                            Character.isIdentifierIgnorable(ch);
198:                        }
199:                    }
200:
201:                    public long getOperationsPerIteration() {
202:                        return MAX_ - MIN_ + 1;
203:                    }
204:                };
205:            }
206:
207:            PerfTest.Function testIsISOControl() {
208:                return new PerfTest.Function() {
209:                    public void call() {
210:                        for (int ch = MIN_; ch < MAX_; ch++) {
211:                            UCharacter.isISOControl(ch);
212:                        }
213:                    }
214:
215:                    public long getOperationsPerIteration() {
216:                        return MAX_ - MIN_ + 1;
217:                    }
218:                };
219:            }
220:
221:            PerfTest.Function testJDKIsISOControl() {
222:                return new PerfTest.Function() {
223:                    public void call() {
224:                        for (char ch = (char) MIN_; ch < (char) MAX_; ch++) {
225:                            Character.isISOControl(ch);
226:                        }
227:                    }
228:
229:                    public long getOperationsPerIteration() {
230:                        return MAX_ - MIN_ + 1;
231:                    }
232:                };
233:            }
234:
235:            PerfTest.Function testIsLetter() {
236:                return new PerfTest.Function() {
237:                    public void call() {
238:                        for (int ch = MIN_; ch < MAX_; ch++) {
239:                            UCharacter.isLetter(ch);
240:                        }
241:                    }
242:
243:                    public long getOperationsPerIteration() {
244:                        return MAX_ - MIN_ + 1;
245:                    }
246:                };
247:            }
248:
249:            PerfTest.Function testJDKIsLetter() {
250:                return new PerfTest.Function() {
251:                    public void call() {
252:                        for (char ch = (char) MIN_; ch < (char) MAX_; ch++) {
253:                            Character.isLetter(ch);
254:                        }
255:                    }
256:
257:                    public long getOperationsPerIteration() {
258:                        return MAX_ - MIN_ + 1;
259:                    }
260:                };
261:            }
262:
263:            PerfTest.Function testIsLetterOrDigit() {
264:                return new PerfTest.Function() {
265:                    public void call() {
266:                        for (int ch = MIN_; ch < MAX_; ch++) {
267:                            UCharacter.isLetterOrDigit(ch);
268:                        }
269:                    }
270:
271:                    public long getOperationsPerIteration() {
272:                        return MAX_ - MIN_ + 1;
273:                    }
274:                };
275:            }
276:
277:            PerfTest.Function testJDKIsLetterOrDigit() {
278:                return new PerfTest.Function() {
279:                    public void call() {
280:                        for (char ch = (char) MIN_; ch < (char) MAX_; ch++) {
281:                            Character.isLetterOrDigit(ch);
282:                        }
283:                    }
284:
285:                    public long getOperationsPerIteration() {
286:                        return MAX_ - MIN_ + 1;
287:                    }
288:                };
289:            }
290:
291:            PerfTest.Function testIsLowerCase() {
292:                return new PerfTest.Function() {
293:                    public void call() {
294:                        for (int ch = MIN_; ch < MAX_; ch++) {
295:                            UCharacter.isLowerCase(ch);
296:                        }
297:                    }
298:
299:                    public long getOperationsPerIteration() {
300:                        return MAX_ - MIN_ + 1;
301:                    }
302:                };
303:            }
304:
305:            PerfTest.Function testJDKIsLowerCase() {
306:                return new PerfTest.Function() {
307:                    public void call() {
308:                        for (char ch = (char) MIN_; ch < (char) MAX_; ch++) {
309:                            Character.isLowerCase(ch);
310:                        }
311:                    }
312:
313:                    public long getOperationsPerIteration() {
314:                        return MAX_ - MIN_ + 1;
315:                    }
316:                };
317:            }
318:
319:            PerfTest.Function testIsSpaceChar() {
320:                return new PerfTest.Function() {
321:                    public void call() {
322:                        for (int ch = MIN_; ch < MAX_; ch++) {
323:                            UCharacter.isSpaceChar(ch);
324:                        }
325:                    }
326:
327:                    public long getOperationsPerIteration() {
328:                        return MAX_ - MIN_ + 1;
329:                    }
330:                };
331:            }
332:
333:            PerfTest.Function testJDKIsSpaceChar() {
334:                return new PerfTest.Function() {
335:                    public void call() {
336:                        for (char ch = (char) MIN_; ch < (char) MAX_; ch++) {
337:                            Character.isSpaceChar(ch);
338:                        }
339:                    }
340:
341:                    public long getOperationsPerIteration() {
342:                        return MAX_ - MIN_ + 1;
343:                    }
344:                };
345:            }
346:
347:            PerfTest.Function testIsTitleCase() {
348:                return new PerfTest.Function() {
349:                    public void call() {
350:                        for (int ch = MIN_; ch < MAX_; ch++) {
351:                            UCharacter.isTitleCase(ch);
352:                        }
353:                    }
354:
355:                    public long getOperationsPerIteration() {
356:                        return MAX_ - MIN_ + 1;
357:                    }
358:                };
359:            }
360:
361:            PerfTest.Function testJDKIsTitleCase() {
362:                return new PerfTest.Function() {
363:                    public void call() {
364:                        for (char ch = (char) MIN_; ch < (char) MAX_; ch++) {
365:                            Character.isTitleCase(ch);
366:                        }
367:                    }
368:
369:                    public long getOperationsPerIteration() {
370:                        return MAX_ - MIN_ + 1;
371:                    }
372:                };
373:            }
374:
375:            PerfTest.Function testIsUnicodeIdentifierPart() {
376:                return new PerfTest.Function() {
377:                    public void call() {
378:                        for (int ch = MIN_; ch < MAX_; ch++) {
379:                            UCharacter.isUnicodeIdentifierPart(ch);
380:                        }
381:                    }
382:
383:                    public long getOperationsPerIteration() {
384:                        return MAX_ - MIN_ + 1;
385:                    }
386:                };
387:            }
388:
389:            PerfTest.Function testJDKIsUnicodeIdentifierPart() {
390:                return new PerfTest.Function() {
391:                    public void call() {
392:                        for (char ch = (char) MIN_; ch < (char) MAX_; ch++) {
393:                            Character.isUnicodeIdentifierPart(ch);
394:                        }
395:                    }
396:
397:                    public long getOperationsPerIteration() {
398:                        return MAX_ - MIN_ + 1;
399:                    }
400:                };
401:            }
402:
403:            PerfTest.Function testIsUnicodeIdentifierStart() {
404:                return new PerfTest.Function() {
405:                    public void call() {
406:                        for (int ch = MIN_; ch < MAX_; ch++) {
407:                            UCharacter.isUnicodeIdentifierStart(ch);
408:                        }
409:                    }
410:
411:                    public long getOperationsPerIteration() {
412:                        return MAX_ - MIN_ + 1;
413:                    }
414:                };
415:            }
416:
417:            PerfTest.Function testJDKIsUnicodeIdentifierStart() {
418:                return new PerfTest.Function() {
419:                    public void call() {
420:                        for (char ch = (char) MIN_; ch < (char) MAX_; ch++) {
421:                            Character.isUnicodeIdentifierStart(ch);
422:                        }
423:                    }
424:
425:                    public long getOperationsPerIteration() {
426:                        return MAX_ - MIN_ + 1;
427:                    }
428:                };
429:            }
430:
431:            PerfTest.Function testIsUpperCase() {
432:                return new PerfTest.Function() {
433:                    public void call() {
434:                        for (char ch = (char) MIN_; ch < (char) MAX_; ch++) {
435:                            UCharacter.isUpperCase(ch);
436:                        }
437:                    }
438:
439:                    public long getOperationsPerIteration() {
440:                        return MAX_ - MIN_ + 1;
441:                    }
442:                };
443:            }
444:
445:            PerfTest.Function testJDKIsUpperCase() {
446:                return new PerfTest.Function() {
447:                    public void call() {
448:                        for (char ch = (char) MIN_; ch < (char) MAX_; ch++) {
449:                            Character.isUpperCase(ch);
450:                        }
451:                    }
452:
453:                    public long getOperationsPerIteration() {
454:                        return MAX_ - MIN_ + 1;
455:                    }
456:                };
457:            }
458:
459:            PerfTest.Function testIsWhiteSpace() {
460:                return new PerfTest.Function() {
461:                    public void call() {
462:                        for (int ch = MIN_; ch < MAX_; ch++) {
463:                            UCharacter.isWhitespace(ch);
464:                        }
465:                    }
466:
467:                    public long getOperationsPerIteration() {
468:                        return MAX_ - MIN_ + 1;
469:                    }
470:                };
471:            }
472:
473:            PerfTest.Function testJDKIsWhiteSpace() {
474:                return new PerfTest.Function() {
475:                    public void call() {
476:                        for (char ch = (char) MIN_; ch < (char) MAX_; ch++) {
477:                            Character.isWhitespace(ch);
478:                        }
479:                    }
480:
481:                    public long getOperationsPerIteration() {
482:                        return MAX_ - MIN_ + 1;
483:                    }
484:                };
485:            }
486:
487:            // private data member --------------------------------------------------
488:
489:            /**
490:             * Minimum codepoint to do test. Test is ran from MIN_ to MAX_
491:             */
492:            private static int MIN_;
493:            /**
494:             * Minimum codepoint to do test. Test is ran from MIN_ to MAX_
495:             */
496:            private static int MAX_;
497:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.