i have a problem reading a memory trace. I’ve read it and saved the pages and their references on a map
Map structure:
Map<Integer, List<Integer>> map = new HashMap<>();
And then i read the file again and remove the references from the Integer List
FileReader arq = new FileReader(new File(Path));
BufferedReader reader = new BufferedReader(arq, 41943040);
while ( (std = reader.readLine()) != null ) {
requestedPage = Integer.parseInt(std, 16);
//do something
M.map.get(requestedPage).remove(0));
}
The problem is it takes too long to remove those references and for big traces it takes hours to remove the references. Does anyone have another solution?
Thank you!
I think that if
remove(0)is the only remove operation you’re going to make on this list a LinkedList is a much better data structure:try: