Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!feeder.news-service.com!postnews.google.com!news1.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nx01.iad01.newshosting.com!newshosting.com!post02.iad!not-for-mail From: lbrt chx _ gemale kom Newsgroups: comp.lang.java.programmer Subject: baseline performance test using java ... X-Newsreader: NetComponents Organization: Acecape, Inc. Organization: Newshosting.com - Highest quality at a great price! www.newshosting.com X-Complaints-To: abuse(at)newshosting.com Message-ID: <1309646728.550644@nntp.aceinnovative.com> Cache-Post-Path: nntp.aceinnovative.com!unknown@p70-44.acedsl.com X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/) Date: 02 Jul 2011 22:45:28 GMT Lines: 33 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:5824 ~ I have searched to no avail for some kind of hardware baseline performance test for a piece of code. ~ Notice that I don't mean to "profile" code, with "baseline" I mean that the actual performance of an algorithm should me gauged against its underlying hardware and OS, like its I/O subsystem (RAM (types, speed, amount), file access, ...) ~ We have all learned we should avoid String(s) and use StringBuffer(s) or better yet StringBuilder(s) but there is definitely more to performance testing/gains ~ It does not make any sense to say some code runs "fast" when you do not specify "fast" in relation to what. In fact good software developers treat themselves with crappy/poor boxes ;-) ~ Unless the algo deals with no logic (say, just raw I/O (which is what OSs should do anyway)) there is going to always be an actual delay due to the logical stack of your algorithm/code on top, so the delay should be given as a percentage relative to the underlying performance ~ This is approximately what I have in mind; you would run your code like: ~ http://download.oracle.com/javase/1.5.0/docs/tooldocs/solaris/java.html ~ java -version > version.txt java -verbose:class -XX:+PrintGCTimeStamps -XX:+PrintGCDetails code class.txt 2>&1 java -verbose:jni -XX:+PrintGCTimeStamps -XX:+PrintGCDetails code jni.txt 2>&1 java -verbose:gc -XX:+PrintGCTimeStamps -XX:+PrintGCDetails code gc.txt 2>&1 ~ from where you could know "where the rubber meets the road" and then, say; if you notice in class.txt and jni.txt lines like: ~ [Loaded java.io.FileOutputStream from /media/sda1/inst/sw/jdk/jdk1.7.0/jre/lib/rt.jar] ~ [Dynamic-linking native method java.io.FileOutputStream.writeBytes ... JNI] ~ and FileOutputStream.writeBytes tax your code, then some test units could be automatically produced in order to just go FileOutputStream.writeBytes (without logic of your code) and even different forms of writeBytes out of the java API could be tried (nio ...) and those file system areas a user has access to. ~ This is more testing/profiling methodology than strictly Java related so the java results could be used for some other code as well ~ Anything like this out there you could use? ~ lbrtchx