Home>

It's a rough question,

I want to be aware of resources such as memory management and CPU.
What kind of code should be written in what language to reduce consumption and how to use it efficiently? I want to learn that.

Specifically, when dealing with a large number of log files, write code using a language that is efficient and good at memory management.
If there is a memory consumption code and it is due to the language, rewriting in C language speeds up the process.
I would like to give some insight to that area.

I'm not in a situation where such resource management is done carefully, so I don't really think about what language to use or how to write it.

If there is a good way to learn, I would like you to give me a hint.

  • Answer # 1

    "Programming with consideration for resources such as memory management and CPU" is a means (mainly for improving performance, etc.) and does not serve the purpose.

    Also, there is no methodology that works for all languages ​​and all cases in the world.

    And perhaps you won't get the knowledge and experience you're looking for without actually working on improving a program that has problems with the "resources such as memory management and CPU" part.

    Each person has their own way of learning, but there is a saying that there is no royal road to learning.

    As in the other answers, first input from basic knowledge such as language, OS mechanism, hardware mechanism, etc., investigate "problem programs", find the root cause, and solve the problem. please try.

    At first, I think the first step is to improve the code you've come across, but if you're in a great environment where you can't find any improvements in the code you've written so far, there are countless things out there on GitHub. Another option is to start by contributing to improving the performance of existing OSS.

    If you look for an issue that requires performance improvement, you can find it, so let's find out and put into practice the best method for the language and product.

  • Answer # 2

    ・ CPU mechanism
    ・ OS mechanism
    ・ Mechanism of language processing system
    I think I should learn.

    If it's from scratch, it feels tough in a year, and if you take the time, it's not something that anyone can understand.
    First of all, read a book about the mechanism of the OS or the mechanism of the language processing system, and if you can understand it, you should proceed to the next step.

  • Answer # 3

    There are various algorithms for sorting.
    The speed and memory usage vary greatly depending on the algorithm.

    If it is about 1000, there will be no big difference in any method.
    Sorting 10 million or hundreds of millions of items will require not only algorithms but also various implementation measures.

    You can find a lot of explanations in programming textbooks about the complexity of sorting.

    Even if you implement a thinking routine on a game (such as Othello) machine, you cannot help but be aware of speed, memory usage, etc., whether you try to make it stronger or not.

    If you try to go even higher, you will face an awareness of efficient use of resources.

  • Answer # 4

    Let's study programming in C language and actually write the code.
    I will wear it