boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - improve speed
相关主题
Simple question: delete element from collection on condition?
java ArrayList 一问 (转载)
web service returns HashMap that contains multiple ArrayList
List, LinkedList and Vector
Stupid IBM JVM: operator precedence
在一个函数里把arraylist设为null 但是有问题
我想把一个Arraylist转成String[]
Re: Is there any way to uniquely identif
[转载] javascript怎么访问JSP里的arraylist?
Java里有没有象cell array一样的东西
相关话题的讨论汇总
话题: loop话题: data话题: your话题: arraylist话题: code
进入Java版参与讨论
1 (共1页)
G*********a
发帖数: 1080
1
it's such a happy thing improve the speed of my crap code when dealing with
that huge dataset. anyone knows any particular place talking about this type
of similar topics?
w*r
发帖数: 2421
2
yes, that sounds terrific, creating object is resource consuming, avoiding
create too many instance is very important, however, sometime it is not quite
easy in java as the language does not provide lightweighted struct mechanism.
for loop is a controversial issue, using the for loop can help compiler to
inline your code, hoewver, reckless design for loop without checking the real
boundary of loop is a waste of system resource. i would say if you know that
your loop will definitely executed for

【在 G*********a 的大作中提到】
: it's such a happy thing improve the speed of my crap code when dealing with
: that huge dataset. anyone knows any particular place talking about this type
: of similar topics?

G*********a
发帖数: 1080
3
exactly! To segment the huge data into smaller chunks at beginning also helps.
It's really important to control the memory usage, once my crab code crash my
computer when i run it on a large microarray data.

from
to
of

【在 w*r 的大作中提到】
: yes, that sounds terrific, creating object is resource consuming, avoiding
: create too many instance is very important, however, sometime it is not quite
: easy in java as the language does not provide lightweighted struct mechanism.
: for loop is a controversial issue, using the for loop can help compiler to
: inline your code, hoewver, reckless design for loop without checking the real
: boundary of loop is a waste of system resource. i would say if you know that
: your loop will definitely executed for

w*r
发帖数: 2421
4
for these codes, they should compile the same way, compiler may unrolling the
body of the loop multiple times to eliminate the testing at the end/begnning
of the loop,
other sittuations may be differnet,
t=0
while(t<1000){
if(j){
then c[t]=j(p)
t++
}
else{
c=f(p,t)
t++
}
}
if compiler is smart enough, it may figure out this simple program, if the
optimization code is not good enough, it may turn into different structure, A
good c
G*********a
发帖数: 1080
5
exactly! To segment the huge data into smaller chunks at beginning also helps.
It's really important to control the memory usage, once my crab code crash my
computer when i run it on a large microarray data.

from
to
of

【在 w*r 的大作中提到】
: for these codes, they should compile the same way, compiler may unrolling the
: body of the loop multiple times to eliminate the testing at the end/begnning
: of the loop,
: other sittuations may be differnet,
: t=0
: while(t<1000){
: if(j){
: then c[t]=j(p)
: t++
: }

G*********a
发帖数: 1080
6
oh, sorry, what i refered to was something like this situation: to go through
an ArrayList object, you can use either "for loop" or an "iterator" for this
ArrayList. i think iteraotor is faster than for loop here.
w*r
发帖数: 2421
7
dealing with large dataset is always a difficult issue. situations varies from
on to the other I do not think there will be any sort of universal/generic
solution to optimize the performance under this scenario. The no1 rule is to
go ahead find the complexity of your code. Try to identify the possible way to
reduce the complexity of your code. Try to be conservative on the memory
usage of your code. Deposite the result of your compuration for each block of
data out of your program memory as earl

【在 G*********a 的大作中提到】
: it's such a happy thing improve the speed of my crap code when dealing with
: that huge dataset. anyone knows any particular place talking about this type
: of similar topics?

G*********a
发帖数: 1080
8
i think iterator is much faster than for loop, whenever it can be used.

quite
.
real
,

【在 w*r 的大作中提到】
: yes, that sounds terrific, creating object is resource consuming, avoiding
: create too many instance is very important, however, sometime it is not quite
: easy in java as the language does not provide lightweighted struct mechanism.
: for loop is a controversial issue, using the for loop can help compiler to
: inline your code, hoewver, reckless design for loop without checking the real
: boundary of loop is a waste of system resource. i would say if you know that
: your loop will definitely executed for

w*r
发帖数: 2421
9
streamlize your data into a feeder object(if your computation can be seperated
), feed the data to multiple light weighted computing thread and have a result
deposite controller to stream your data out. Carefully handle the number of
your computation threads so that the computation thread can be constantly
busying with its task without been held by the process of data processing.
Data Feeder (data pre-process/feed to thread) --> (computation thread)*n -->
result deposite bank(handle muliple requ

【在 G*********a 的大作中提到】
: exactly! To segment the huge data into smaller chunks at beginning also helps.
: It's really important to control the memory usage, once my crab code crash my
: computer when i run it on a large microarray data.
:
: from
: to
: of

g*****g
发帖数: 34805
10
I don't see any difference.
between
i=0;
while(i i++;
}
and for(i=0;i }
To my understanding, they would be compiled to the same assembly.

【在 G*********a 的大作中提到】
: i think iterator is much faster than for loop, whenever it can be used.
:
: quite
: .
: real
: ,

w*r
发帖数: 2421
11
yep

【在 G*********a 的大作中提到】
: i think iterator is much faster than for loop, whenever it can be used.
:
: quite
: .
: real
: ,

G*********a
发帖数: 1080
12
oh, sorry, what i refered to was something like this situation: to go through
an ArrayList object, you can use either "for loop" or an "iterator" for this
ArrayList. i think iteraotor is faster than for loop here.

【在 g*****g 的大作中提到】
: I don't see any difference.
: between
: i=0;
: while(i: i++;
: }
: and for(i=0;i: }
: To my understanding, they would be compiled to the same assembly.

g*****g
发帖数: 34805
13
I don't see any difference.
between
i=0;
while(i i++;
}
and for(i=0;i }
To my understanding, they would be compiled to the same assembly.

【在 G*********a 的大作中提到】
: i think iterator is much faster than for loop, whenever it can be used.
:
: quite
: .
: real
: ,

1 (共1页)
进入Java版参与讨论
相关主题
Java里有没有象cell array一样的东西
请问一个有关选择数据结构的问题
请帮忙看看这个编译错误
Java 面试常见问题!
Generic type cast warning
再请教一个 编译错误
ArrayList and Link list
immutable list
is access to int[] faster than List?
How to check if an element is in an array?
相关话题的讨论汇总
话题: loop话题: data话题: your话题: arraylist话题: code