由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 新手请教Java数组问题
相关主题
vert.x 基本上没戏其实说穿了, java就是一种可以让初中生廉价劳动力写程序的语言
数组,结构,类在数值计算中哪个快c++程序员不要把头埋在沙子里了
Eclipse JNI问题, 拜谢为什么我觉得c++比java简单?
C++ and javaC++缺少了哪些开源的轮子?
【失败感言】我是做PHP的 (转载)好像核心用C++的公司更成功
Linux/C++的工作好难找java多维数组,其实是个很好的商业机会啊
JAVA vs C/C++之争, 我来做个小结吧java小问题
Sun当年设计Java的败笔Android NDK到底应该和Android Studio一起用还是和ADT一起用?
相关话题的讨论汇总
话题: java话题: c++话题: eclipse话题: 内存话题: double
进入Programming版参与讨论
1 (共1页)
G*****9
发帖数: 3225
1
在为公司把一个老C++代码转化成为Java。
有一个操作大约是如下的:
int n = 500;
double[][][] V = new double[n][][];

for(int t = 0; t < n; ++t)
{
V[t] = new double[n][];
for(int i = 0; i < n; ++i)V[t][i] = new double[n];
}
结果Eclipse报错说内存不够了。这大约需要1G的内存而已。
是不是Eclipse会给内存设定上界?怎么在Eclipse中调整内存上限?
d****i
发帖数: 4809
2
If you have this kind of code, you should never think about converting this
code from C++ to Java because Java is notoriously slow and bad for
multidimensional array and numerical computation like this. So your group's
decision must be wrong.

【在 G*****9 的大作中提到】
: 在为公司把一个老C++代码转化成为Java。
: 有一个操作大约是如下的:
: int n = 500;
: double[][][] V = new double[n][][];
:
: for(int t = 0; t < n; ++t)
: {
: V[t] = new double[n][];
: for(int i = 0; i < n; ++i)V[t][i] = new double[n];
: }

G*****9
发帖数: 3225
3
Yes. I bet so.
In fact, I tell the group that we should leave this type of things to C++
and use Java to drive C++ written SO files. However, I turn out to be the
few knowing C++ in the group, while the rest would only learn Java.

this
s

【在 d****i 的大作中提到】
: If you have this kind of code, you should never think about converting this
: code from C++ to Java because Java is notoriously slow and bad for
: multidimensional array and numerical computation like this. So your group's
: decision must be wrong.

d****i
发帖数: 4809
4
Then you should leave it as a C++ lib and give the so file to the Java folks
to call it via JNI or JNA. Pretty easy and straightforward.

【在 G*****9 的大作中提到】
: Yes. I bet so.
: In fact, I tell the group that we should leave this type of things to C++
: and use Java to drive C++ written SO files. However, I turn out to be the
: few knowing C++ in the group, while the rest would only learn Java.
:
: this
: s

g*****g
发帖数: 34805
5
https://wiki.eclipse.org/FAQ_How_do_I_increase_the_heap_size_available_to_
Eclipse%3F

【在 G*****9 的大作中提到】
: 在为公司把一个老C++代码转化成为Java。
: 有一个操作大约是如下的:
: int n = 500;
: double[][][] V = new double[n][][];
:
: for(int t = 0; t < n; ++t)
: {
: V[t] = new double[n][];
: for(int i = 0; i < n; ++i)V[t][i] = new double[n];
: }

G*****9
发帖数: 3225
6
That is exactly what I am thinking. The team lead is green in coding and
fears C++.

folks

【在 d****i 的大作中提到】
: Then you should leave it as a C++ lib and give the so file to the Java folks
: to call it via JNI or JNA. Pretty easy and straightforward.

g*****g
发帖数: 34805
7
It's OK to use JNI, if the performance is critical to the system and Java is
not fast enough. In reality, only select domain is like that. In any case,
it should not be hard to do a prototype and compare performance before you
decide which direction is the right one. The Java is slow argument is often
premature.

【在 G*****9 的大作中提到】
: That is exactly what I am thinking. The team lead is green in coding and
: fears C++.
:
: folks

G*****9
发帖数: 3225
8
Thank you! I understand your point.
Java's efficiency has been greatly improved, while C++ is enhanced for the
ease-of-use. But each is still the best in their own domain. In my minds, I
still prefer to leveraging the best piece of the two languages.

is
,
often

【在 g*****g 的大作中提到】
: It's OK to use JNI, if the performance is critical to the system and Java is
: not fast enough. In reality, only select domain is like that. In any case,
: it should not be hard to do a prototype and compare performance before you
: decide which direction is the right one. The Java is slow argument is often
: premature.

1 (共1页)
进入Programming版参与讨论
相关主题
Android NDK到底应该和Android Studio一起用还是和ADT一起用?【失败感言】我是做PHP的 (转载)
请问java有类似fsync之类的方法?Linux/C++的工作好难找
JAVA 如何调用现成的dllJAVA vs C/C++之争, 我来做个小结吧
一个嵌入式系统的设计构思Sun当年设计Java的败笔
vert.x 基本上没戏其实说穿了, java就是一种可以让初中生廉价劳动力写程序的语言
数组,结构,类在数值计算中哪个快c++程序员不要把头埋在沙子里了
Eclipse JNI问题, 拜谢为什么我觉得c++比java简单?
C++ and javaC++缺少了哪些开源的轮子?
相关话题的讨论汇总
话题: java话题: c++话题: eclipse话题: 内存话题: double