This as an impact of generating a code less optimized for speed and as a consequence less optimized for power consumption. This is obtained by selecting it with the gcc option -Os. The first simple option you have to use to reduce the code size is to tell the compiler to optimize your compilation for this. Memory region Used Size Region Size %age UsedįLASH: 149540 B 192 KB 76.06% Flash size optimizationīasically, the default settings on STM32 Cube IDE are good, most of the optimization are already set but we can get some more. You pass to the linker is an interesting one because it prints the result even if your code base or memory footprint is too large. There are some option to get a report during link step to have these information. Display the sizeīefore optimize something we need to see it. In this post I want to share what I found and how it helped me. In a recent project I was looking for some optimization I could apply on top of the basic existing settings to reduce the FLASH and RAM size. This suite is based on Eclipse and GCC and it works quite well. So I never could teach him how I did cube roots or explain how lucky I was that he happened to choose 1729.03.I’m using STM32 Cube IDE suite for STM32 development. So we're slower at basic arithmetic, but we know numbers.įurthermore, the whole idea of an approximate method was beyond him, even though a cubic root often cannot be computed exactly by any method. You don't have to memorize 9+7=16 you just know that when you add 9, you push a ten's bead up and pull a one's bead down. With the abacus, you don't have to memorize a lot of arithmetic combinations all you have to do is to learn to push the little beads up and down. I realized something: he doesn't know numbers. He picks up his abacus: zzzzzzzzzzzzzzz "Oh yes," he says. I started to explain that it was an approximate method, and had to do with the percentage of error. "Tell me," he said, "how were you able to do that cube-root problem so fast?" So I was able to pull out a whole lot of digits that way.Ī few weeks later, the man came into the cocktail lounge of the hotel I was staying at. So all I had to do is find the fraction 1/1728, and multiply by 4 (divide by 3 and multiply by 12). The excess, 1.03 is only one part in nearly 2000, and I had learned in calculus that for small fractions, the cube root's excess is one-third of the number's excess. I happened to know that a cubic foot contains 1728 cubic inches, so the answer is a tiny bit more than 12. He was completely washed out, and left, humiliated. They tell the man, "Look! He does it only by thinking, and you need an abacus! He's got more digits!" He finally lifts his head to say, "12.01!" He buries himself again, grunting " Rrrrgrrrrmmmmmm. "More digits! More digits!" I know that in taking a cube root by arithmetic, each new digit is even more work that the one before. The man with the abacus wipes the sweat off his forehead: "Twelve!" he says. One of the waiters says, "What are you doing?". He starts working on it, mumbling and grumbling: " Mmmmmmagmmmmbrrr" he's working like a demon! He's poring away, doing this cube root. He writes down a number on some paper any old number and I still remember it: 1729.03. It must have been his topnotch exercise in abacus-land. It's hard to find a more difficult fundamental problem in arithmetic. Cube roots! He wants to do cube roots by arithmetic. " Raios cubicos!" he says with a vengeance. The bothered the hell out of the Japanese man, because he was apparently well trained on the abacus, and here he was almost beaten by this customer in a restaurant. What he didn't realize was, the harder the problem, the better chance I had. The man then made a mistake: he proposed we go on to division. He beat me again, but not by much, because I'm pretty good at products. However, the man got a little bit excited: he wanted to prove himself some more. I suggested that the waiter write down two identical lists of numbers and hand them to us at the same time. He beat me hollow, because while I was writing the numbers down, he was already adding them as he went along. The man asked a waiter to call out some numbers to add. I protested, "But I don't speak Portuguese well!" Why don't you go over and challenge the customer over there?" The waiters didn't want to lose face, so they said, "Yeah, yeah. He started to talk to the waiters, and challenged them: He said he could add numbers faster than any of them could do. I had seen him before, wandering around he was trying to sell abacuses. The setting is Brazil the narrator is Richard Feynman.Ī Japanese man came into the restaurant. The Abacus This is an excerpt from the chapter "Lucky Numbers", in Surely, You're Joking, Mr.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |