android cache! Android performance optimization start optimization actual combat article, successfully joined Ali

Preface

  • If you also learn Android, then you will probably have read my article. Readers often leave me messages: "How do I learn Android?", "What is the daily way to learn Android".

  • So, today, I will present an "Android Knowledge Graph" , based on my own experience & what I have seen and heard, to tell you what you actually need to learn to learn Android , I hope you will like it.

Second floor

The interviewer was not satisfied with my stealing tricks, he needed me to speed up, this speed is not good.

What? ? Is there a lower time complexity? No, no, this is a core issue that turns out to be a multi-threaded problem.

  1. The 1 billion data is divided into pieces, and the data is processed for the first time through the thinking of divide and conquer.
  2. Start multithreading and perform priority queue operations on the fragmented data.
  3. Then each child thread filters out the largest number of k
  4. Consolidate data when all threads are executed

I guess the third layer

  1. Is it a question of how many pieces of data should be taken into consideration, and then how to improve the performance to the highest level?
  2. How many threads are constructed to have the highest reading efficiency?

I didn't expect this, everyone who has ideas can talk about it.

Question 2: The number of words in an article

This question seems to be easy at first glance. If the foreach loop encounters a space or punctuation, sum++ can solve this problem.

However, things are not as simple as thought. The interview was asked what is the most difficult problem of this kind of question, it may be thinking about the real boundary question of this topic.

  1. What if the content of this article is very large, will it eat up memory?
  2. How to remove repetitions for words?

Can you consider reading it line by line?

Convert it into an IO stream, read the stream line by line, and then perform a counting operation on the input content. Can this problem be solved?

Word repetition problem

Fuck, this is really simple HashSet! ! ! ! So if the massive amount of data would I explode again?

Damn it, death spiral. Maybe we can consider using the hash method to solve it, just keep the hashcode of the word, is it possible to solve it?

The same can also be optimized using multi-threaded sharding

The method is basically the same as the above, as long as the data is fragmented, then multi-threaded scheduling, and then the results are combined.

to sum up

Finally, in order to help everyone deeply understand the principles of Android-related knowledge points and interview-related knowledge, here are the 14 sets of real interview questions that I have collected and compiled by Tencent, ByteDance, Ali, Baidu and other 2020 interview questions . I have organized the technical points into Video and PDF (actually took a lot more effort than expected), including knowledge + many details.

2020 Interview Questions Analysis
Analysis of Tencent Interview Questions

Analysis of Alibaba Interview Questions

Analysis of ByteDance Interview Questions
There are a lot of materials for learning Android on the Internet, but if the knowledge learned is not structured, and when you encounter problems, you just taste it and do not research in depth, then it is difficult to achieve real technical improvement. I hope this systematic technical system can provide you with a direction reference.

BC%81.md) has a direction reference for everyone.

[External link image is being transferred...(img-2o1sWUEQ-1614574529913)]

Guess you like

Origin blog.csdn.net/m0_52308677/article/details/114260368