Is clearing big lists needed for performance improvements [on hold]
up vote
-1
down vote
favorite
I have a method used to collect some data and send it to external service. In previous implementation I would use my own implementation of paging and collect 100 entities at the time and synchronize it. Since my way did not work same on oracle and mysql DBs I have decided to change it to fetch all entity ids and then split it in pages and send page by page.
Currently it looks like this
final List<String> ids = dataService.collectAllIds(user, type);
final List<List<String>> pages = Lists.partition(ids, 100);
for (int pageIndex = 0; pageIndex < pages.size(); pageIndex++) {
final List<String> page = pages.get(pageIndex);
// do something with page
}
After splitting it and geting pages
list I do not need ids
list anymore. Would it help if I clear it at this point in regards of performance ? List of ids can contain up to 1.7 million entries.
java performance memory-optimization
New contributor
put on hold as off-topic by 200_success, Heslacher, Toby Speight, RoToRa, Mast 3 hours ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Lacks concrete context: Code Review requires concrete code from a project, with sufficient context for reviewers to understand how that code is used. Pseudocode, stub code, hypothetical code, obfuscated code, and generic best practices are outside the scope of this site." – 200_success, Heslacher, Toby Speight, RoToRa, Mast
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
up vote
-1
down vote
favorite
I have a method used to collect some data and send it to external service. In previous implementation I would use my own implementation of paging and collect 100 entities at the time and synchronize it. Since my way did not work same on oracle and mysql DBs I have decided to change it to fetch all entity ids and then split it in pages and send page by page.
Currently it looks like this
final List<String> ids = dataService.collectAllIds(user, type);
final List<List<String>> pages = Lists.partition(ids, 100);
for (int pageIndex = 0; pageIndex < pages.size(); pageIndex++) {
final List<String> page = pages.get(pageIndex);
// do something with page
}
After splitting it and geting pages
list I do not need ids
list anymore. Would it help if I clear it at this point in regards of performance ? List of ids can contain up to 1.7 million entries.
java performance memory-optimization
New contributor
put on hold as off-topic by 200_success, Heslacher, Toby Speight, RoToRa, Mast 3 hours ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Lacks concrete context: Code Review requires concrete code from a project, with sufficient context for reviewers to understand how that code is used. Pseudocode, stub code, hypothetical code, obfuscated code, and generic best practices are outside the scope of this site." – 200_success, Heslacher, Toby Speight, RoToRa, Mast
If this question can be reworded to fit the rules in the help center, please edit the question.
1
You seem to be asking a specific question about a practice in general (clearing lists), with a minimal excerpt that serves merely as an example. Please show your real code, in context and without placeholder comments, so that we can review it properly and give you the right advice. See How to Ask.
– 200_success
9 hours ago
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I have a method used to collect some data and send it to external service. In previous implementation I would use my own implementation of paging and collect 100 entities at the time and synchronize it. Since my way did not work same on oracle and mysql DBs I have decided to change it to fetch all entity ids and then split it in pages and send page by page.
Currently it looks like this
final List<String> ids = dataService.collectAllIds(user, type);
final List<List<String>> pages = Lists.partition(ids, 100);
for (int pageIndex = 0; pageIndex < pages.size(); pageIndex++) {
final List<String> page = pages.get(pageIndex);
// do something with page
}
After splitting it and geting pages
list I do not need ids
list anymore. Would it help if I clear it at this point in regards of performance ? List of ids can contain up to 1.7 million entries.
java performance memory-optimization
New contributor
I have a method used to collect some data and send it to external service. In previous implementation I would use my own implementation of paging and collect 100 entities at the time and synchronize it. Since my way did not work same on oracle and mysql DBs I have decided to change it to fetch all entity ids and then split it in pages and send page by page.
Currently it looks like this
final List<String> ids = dataService.collectAllIds(user, type);
final List<List<String>> pages = Lists.partition(ids, 100);
for (int pageIndex = 0; pageIndex < pages.size(); pageIndex++) {
final List<String> page = pages.get(pageIndex);
// do something with page
}
After splitting it and geting pages
list I do not need ids
list anymore. Would it help if I clear it at this point in regards of performance ? List of ids can contain up to 1.7 million entries.
java performance memory-optimization
java performance memory-optimization
New contributor
New contributor
New contributor
asked 9 hours ago
mirzak
99
99
New contributor
New contributor
put on hold as off-topic by 200_success, Heslacher, Toby Speight, RoToRa, Mast 3 hours ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Lacks concrete context: Code Review requires concrete code from a project, with sufficient context for reviewers to understand how that code is used. Pseudocode, stub code, hypothetical code, obfuscated code, and generic best practices are outside the scope of this site." – 200_success, Heslacher, Toby Speight, RoToRa, Mast
If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as off-topic by 200_success, Heslacher, Toby Speight, RoToRa, Mast 3 hours ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Lacks concrete context: Code Review requires concrete code from a project, with sufficient context for reviewers to understand how that code is used. Pseudocode, stub code, hypothetical code, obfuscated code, and generic best practices are outside the scope of this site." – 200_success, Heslacher, Toby Speight, RoToRa, Mast
If this question can be reworded to fit the rules in the help center, please edit the question.
1
You seem to be asking a specific question about a practice in general (clearing lists), with a minimal excerpt that serves merely as an example. Please show your real code, in context and without placeholder comments, so that we can review it properly and give you the right advice. See How to Ask.
– 200_success
9 hours ago
add a comment |
1
You seem to be asking a specific question about a practice in general (clearing lists), with a minimal excerpt that serves merely as an example. Please show your real code, in context and without placeholder comments, so that we can review it properly and give you the right advice. See How to Ask.
– 200_success
9 hours ago
1
1
You seem to be asking a specific question about a practice in general (clearing lists), with a minimal excerpt that serves merely as an example. Please show your real code, in context and without placeholder comments, so that we can review it properly and give you the right advice. See How to Ask.
– 200_success
9 hours ago
You seem to be asking a specific question about a practice in general (clearing lists), with a minimal excerpt that serves merely as an example. Please show your real code, in context and without placeholder comments, so that we can review it properly and give you the right advice. See How to Ask.
– 200_success
9 hours ago
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
1
You seem to be asking a specific question about a practice in general (clearing lists), with a minimal excerpt that serves merely as an example. Please show your real code, in context and without placeholder comments, so that we can review it properly and give you the right advice. See How to Ask.
– 200_success
9 hours ago