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.










share|improve this question







New contributor




mirzak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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















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.










share|improve this question







New contributor




mirzak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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













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.










share|improve this question







New contributor




mirzak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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






share|improve this question







New contributor




mirzak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




mirzak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




mirzak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 9 hours ago









mirzak

99




99




New contributor




mirzak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





mirzak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






mirzak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




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














  • 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















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

Ellipse (mathématiques)

Quarter-circle Tiles

Mont Emei