sinboy的菜地
一份耕耘,一份收获
登录
注册
全站
当前博客
空间
博客
好友
相册
留言
sinboy
sinboy的公告
喜欢中文分词技术的朋友请入
http://groups.google.com/group/ictclas
最近评论
yuzishui:
呵呵,都是要源码的。
谢谢您的知识.
也希望您能坚持下去.
支持.
周梁:
怎么就这两句话?赶紧加强啊。
xazl.ia.ac.cn@gmail.com
周梁:
我刚开始看,这里我觉得楼主可能没有理解,
作者的原意是为了防止权重相同的节点,<判断就是和=判断区别开,如果出现=,i就不会增加,继续会在这个权重下面进行插入父节点。呵呵。
可以参考他的论文一段话:
如果两条或两条以上路径长度相等,那么他们的长度并列第i,都要列入粗分结果集,而且不影响其他路径的排列序号,最后的粗分结果集合大小大于或等于N。
houlc:
我的邮箱是houlc@foxmail.com
houlc:
你能发给我一份吗,我也想在项目中使用log4j,想参考参考你是怎么用的.
文章分类
GIS
(RSS)
JAVA
(RSS)
Linux
(RSS)
Python
(RSS)
全文检索
(RSS)
自然语言
(RSS)
收藏
相册
IO
TPTP
友情链接
DanceFire的BLOG
Justin的BLOG
Martin Fowler
博客园设计模式
吕震宇的BLOG
存档
2008年05月(9)
2007年08月(1)
2007年06月(6)
2007年04月(2)
2007年03月(6)
2007年02月(1)
2006年12月(5)
2006年11月(1)
2006年07月(1)
2006年06月(3)
2006年05月(1)
2006年04月(2)
2006年03月(5)
2005年12月(5)
2005年11月(2)
2005年01月(1)
软件项目交易
订阅我的博客
关于在Java程序当中创建对象等基本操作的性能测试
收藏
新一篇: 关于JAVA中线程同步的性能测试
|
旧一篇: 使用Eclipse性能测试插件TPTP改进你的程序(一)
在Java程序中,创建对象、打印输出到屏幕、启动线程到底需要发
费多长时间?针对这个最基本的问题,做了如下测试:
测试硬件环境:
联想扬天E3100,AMD Sempron 64位 2600+(约1.6Ghz),512M内存,80G硬盘
测试软件环境:
Eclipse3.2.2+JDK5.0,直接在Eclipse下运行
测试代码:
public
class
TestCreatObject
...
{
public
static
void
main(String[] args)
...
{
long
start
=
System.currentTimeMillis();
for
(
int
i
=
0
;i
<
10000
;i
++
)
...
{
String str
=
new
String(
""
+
i );
}
long
end1
=
System.currentTimeMillis();
for
(
int
i
=
0
;i
<
10000
;i
++
)
System.out.println(i);
long
end2
=
System.currentTimeMillis();
for
(
int
i
=
0
;i
<
10000
;i
++
)
...
{
TestThread tt
=
new
TestThread();
tt.start();
}
System.out.println(
"
create object time:
"
+
(end1
-
start));
System.out.println(
"
print screen time:
"
+
(end2
-
end1));
System.out.println(
"
start thread time:
"
+
( System.currentTimeMillis()
-
end2));
}
}
class
TestThread
extends
Thread
...
{
public
void
run()
...
{
//
try {
//
sleep(1);
//
} catch (InterruptedException e) {
//
e.printStackTrace();
//
}
}
}
测试结果:
create object time:32
print screen time:218
start thread time:1844
对线程测试时,该线程运行的时间和启动速度是什么关系呢
?原来的线程本身没有执行任何东西,现在把屏蔽的代码打开
,把sleep()的时间分别从1-》10-》100-
》1000-》10000,结果如下:
1-》start thread time:2110
10-》start thread time:2297
100-》start thread time:2594
1000-》start thread time:5672
10000-》start thread time:49875
结果分析:
1.在Java程序当中,创建对象所花费的时间几乎可以忽略不计
2.打印输出到屏幕因为涉及到IO操作,需要花费一定的时间,约每次0.0218ms,在对系统性能要求不是很高,基本不会影响程序性能的发挥
3.启动大量并发线程需要发费较多的时间,并且虽然线程本身运行时间的长短,花费的时间也直线上升
,看来多线程处理并不是线程越多越好,要有一个适当的度才能最大程
度的发挥系统的性能,当线程的运行时间更长时可能导致内存越界异常
发表于 @
2007年03月22日 14:35:00
|
评论(
loading...
)
|
编辑
新一篇: 关于JAVA中线程同步的性能测试
|
旧一篇: 使用Eclipse性能测试插件TPTP改进你的程序(一)
评论:没有评论。
发表评论
姓 名:
主 页:
校验码:
看不清,换一张
登录