由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - Why My Java Program Is So Slow?
相关主题
Windows 下 Java console application 的问题关于 BufferedReader 问题
[转载] linux下的java sound问题可以多个线程同时读一个文件吗
问个系统问题 (转载)JTextArea行间距如何设定?
弱人再问一个关于Java的问题read from multiple inputstreams at the same time?
Java支持placement new吗?新手问一个多线程的问题
有趣的Thread问题如何让Swing对象即使更新?
一个socket相关的问题求教一个Java问题 IllegalMonitorStateException
新手问题。netflix的用hdtv看它的电影,如果1000用户同时登录看同一个影片,怎么处理的?
相关话题的讨论汇总
话题: java话题: program话题: slow话题: c++话题: my
进入Java版参与讨论
1 (共1页)
b*******9
发帖数: 15
1
Hi,
I rewrote a c++ program to java program. Both syntax and results are the
same. But java program is very slow. c++ is 40 seconds, but java is 800
seconds. Does anyone know the problem and how to improve my java program?
Thanks.
Bejamin
e***e
发帖数: 351
2
Post your code here, maybe ppl can tell

【在 b*******9 的大作中提到】
: Hi,
: I rewrote a c++ program to java program. Both syntax and results are the
: same. But java program is very slow. c++ is 40 seconds, but java is 800
: seconds. Does anyone know the problem and how to improve my java program?
: Thanks.
: Bejamin

b*******9
发帖数: 15
3
Thank emote's reply. But the code is too long to post here.I hopt to get
common ideas like environment, compiling and runing options to improve speed.

【在 e***e 的大作中提到】
: Post your code here, maybe ppl can tell
j******o
发帖数: 82
4
What type of program is that?
How did you make the conversion?
What kind of hardware/OS?
Do you have a lot of I/O access?

【在 b*******9 的大作中提到】
: Hi,
: I rewrote a c++ program to java program. Both syntax and results are the
: same. But java program is very slow. c++ is 40 seconds, but java is 800
: seconds. Does anyone know the problem and how to improve my java program?
: Thanks.
: Bejamin

b*******9
发帖数: 15
5
Thanks, Jojomojo.
his program reads a 压缩 file, then 解压 it.
Only change is to change c++ point to java array. Put many c++ classes and
method to one java class and one method (does this cause speed problem?).
Run on Linux.

【在 j******o 的大作中提到】
: What type of program is that?
: How did you make the conversion?
: What kind of hardware/OS?
: Do you have a lot of I/O access?

m******t
发帖数: 2416
6

All the copying between I/O buffers is probably killing it.
Try map the files into memory.

【在 b*******9 的大作中提到】
: Thanks, Jojomojo.
: his program reads a 压缩 file, then 解压 it.
: Only change is to change c++ point to java array. Put many c++ classes and
: method to one java class and one method (does this cause speed problem?).
: Run on Linux.

A**o
发帖数: 1550
7
and the overhead in array operations as well...
again, no code, hard to say

【在 m******t 的大作中提到】
:
: All the copying between I/O buffers is probably killing it.
: Try map the files into memory.

r*d
发帖数: 896
8
可能是由于JVM吧。

【在 b*******9 的大作中提到】
: Hi,
: I rewrote a c++ program to java program. Both syntax and results are the
: same. But java program is very slow. c++ is 40 seconds, but java is 800
: seconds. Does anyone know the problem and how to improve my java program?
: Thanks.
: Bejamin

o*******a
发帖数: 46
9
profiler the program and find out where is the bottom neck.

【在 b*******9 的大作中提到】
: Hi,
: I rewrote a c++ program to java program. Both syntax and results are the
: same. But java program is very slow. c++ is 40 seconds, but java is 800
: seconds. Does anyone know the problem and how to improve my java program?
: Thanks.
: Bejamin

r*****l
发帖数: 2859
10
Performance is not Java's strong point. I would be surprise
if you say Java is faster than C/C++.

【在 b*******9 的大作中提到】
: Hi,
: I rewrote a c++ program to java program. Both syntax and results are the
: same. But java program is very slow. c++ is 40 seconds, but java is 800
: seconds. Does anyone know the problem and how to improve my java program?
: Thanks.
: Bejamin

k***r
发帖数: 4260
11
JVM startup time is way longer. You would want to take that into account.
Java in general is slower but shouldn't be that slow.
1 (共1页)
进入Java版参与讨论
相关主题
netflix的用hdtv看它的电影,如果1000用户同时登录看同一个影片,怎么处理的?Java支持placement new吗?
强制Swing绘制Panel的一个问题有趣的Thread问题
Hadoop居然是用Java写的,不理解 (转载)一个socket相关的问题
multi-thread 一问,新手问题。
Windows 下 Java console application 的问题关于 BufferedReader 问题
[转载] linux下的java sound问题可以多个线程同时读一个文件吗
问个系统问题 (转载)JTextArea行间距如何设定?
弱人再问一个关于Java的问题read from multiple inputstreams at the same time?
相关话题的讨论汇总
话题: java话题: program话题: slow话题: c++话题: my