由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - code Re: structure in Java??
相关主题
JAVA coding style说说clone咋违反了类继承的原则来的?
Re: In need of an implemetation of Tree structure.java String
请推荐JAVA DATA STRUCTURE 的书Re: unix环境下如何在java程序中执行命令行?
Re: for helpRe: [转载] 如何看某个端口是否被占用?(use UNIX command or ..)
问个题JAVA APPLICATION PATH 一问
Test your PC speed两个很基本的JAVA问题
折腾了一天,实在是绝望了,请教请教jdbc连接数据库出现的问题
Re: how to initialize corba object orb in servletDoes anyone know where I can find this?
相关话题的讨论汇总
话题: java话题: long话题: int话题: count话题: args
进入Java版参与讨论
1 (共1页)
s******M
发帖数: 3435
1
obvious things can often be wrong though.
here is one of tests i coded. certainly, this is an over simplistic operation
but it does tell sth.
try to run with a counter sesnsible large so that it takes seconds. 10^8~9
should be ok.
public class Test{

public static void main(String[] args){
System.out.println("starting...");
long re=0;
long start = System.currentTimeMillis();
int count=Integer.valueOf(args[0]).intValue();
for(int i=0; i re = re+i;
}
long dur = System.currentTim
st
发帖数: 1685
2
your java program:
time passed: 3891 for your program, I set count to 10^9
compare to a small c++ program under vs.net 2003. time passed:844
#include "stdafx.h"
#include "windows.h"
int _tmain(int argc, _TCHAR* argv[])
{
printf("starting...");
long re=0;
long start = GetTickCount();
int count=1000000000;//Integer.valueOf(args[0]).intValue();
for(int i=0; i re = re+i;
}
long dur = GetTickCount() - start;
p

【在 s******M 的大作中提到】
: obvious things can often be wrong though.
: here is one of tests i coded. certainly, this is an over simplistic operation
: but it does tell sth.
: try to run with a counter sesnsible large so that it takes seconds. 10^8~9
: should be ok.
: public class Test{
:
: public static void main(String[] args){
: System.out.println("starting...");
: long re=0;

e***g
发帖数: 158
3
why do you comment out the most expensive part?

【在 st 的大作中提到】
: your java program:
: time passed: 3891 for your program, I set count to 10^9
: compare to a small c++ program under vs.net 2003. time passed:844
: #include "stdafx.h"
: #include "windows.h"
: int _tmain(int argc, _TCHAR* argv[])
: {
: printf("starting...");
: long re=0;
: long start = GetTickCount();

st
发帖数: 1685
4
it's commented out in both programs.

【在 e***g 的大作中提到】
: why do you comment out the most expensive part?
e***g
发帖数: 158
5
wait, i thought it is in the loop. now this program is too trivial
to test anything.

【在 st 的大作中提到】
: it's commented out in both programs.
1 (共1页)
进入Java版参与讨论
相关主题
Does anyone know where I can find this?问个题
问个Thread 的问题,java certificate里的Test your PC speed
question on single thread & multithread折腾了一天,实在是绝望了,请教请教
Urgent help! Java relative file pathRe: how to initialize corba object orb in servlet
JAVA coding style说说clone咋违反了类继承的原则来的?
Re: In need of an implemetation of Tree structure.java String
请推荐JAVA DATA STRUCTURE 的书Re: unix环境下如何在java程序中执行命令行?
Re: for helpRe: [转载] 如何看某个端口是否被占用?(use UNIX command or ..)
相关话题的讨论汇总
话题: java话题: long话题: int话题: count话题: args