Pratique du Shadowing: You are wasting memory - Apprendre l'anglais à l'oral avec la vidéo

Choisissez un mode d'entraînement

Chaque mode ouvre une salle d'entraînement en plein écran.

27 phrases
Si les phrases sont trop courtes ou trop longues, cliquez sur Edit pour les ajuster.
1
Take a look at this C code and tell me what the output of that printf will be.
2
If you said 12, you are correct, and that's because each integer is 4 bytes wide.
3
Now, what happens if I add a character to the structure?
4
You probably already know that a character has a size of 1 byte, but if we run this program, we can see that the structure became 16 bytes.
5
This happens because of memory alignment.
6
You can imagine memory as a row of numbered boxes, where each number represents an address.
7
Each box can hold exactly one byte.
8
We know that on 64-bit machines an integer is usually four bytes.
9
For it to be aligned, its address must be a multiple of its size.
10
If a value is not aligned, on some architectures and older computers, working with it might be slower.
11
But how is the structure represented in memory by the compiler?
12
The structure is represented as a series of consecutive values, each starting at a specific padding from the beginning of of the structure.
13
The padding is needed so that each value is correctly aligned.
14
As you can see here, the value D would occupy only one byte, but three extra bytes are added so that the value C is correctly aligned.
15
If we add another character at the end of the structure, another 3 bytes of padding are added because the whole structure must be aligned to the alignment of the structure itself,
16
which is the maximum alignment between the members of the structure.
17
This way, when creating an array of this structure, the first member is always correctly aligned.
18
So to save memory, we can move our characters close together
19
so that only 2 bytes of padding are added making the whole thing 16 bytes instead of 20, while keeping everything correctly aligned.
20
We can check that in C as well.
21
As you can see, this code represents what was shown in the previous images.
22
Now take a look at the output of this.
23
If we move E, like this, the output changes.
24
Now if you want to ignore alignment and remove padding for some reason, you can use the packed attribute like this on GCC and CLang and the compiler will not insert any padding,
25
as you can see here from this output, but note that on some architectures this might make the code slower.
26
So in conclusion, if you don't wanna waste memory over padding, remember to place your structural members correctly.
27
Bye!

Télécharger l'application

Tout pour parler couramment

Prononciation IAChaque phrase notée
Phonétique (IPA)Maîtrisez chaque son
VocabulaireEnrichissez votre lexique
Jeu de vocabulaireApprenez en jouant
FOR YOU

Vidéo recommandée

Vocabulaire et conseils d’expression pour cette leçon

Cette vidéo contient 27 phrases et 415 mots à répéter en shadowing. La partie parlée dure 2:28. Le locuteur parle à un rythme naturel d’environ 169 mots par minute, proche d’une conversation courante. Seuls 81 % des mots font partie des 3 000 mots les plus courants en anglais, le vocabulaire est donc exigeant.

Vocabulaire clé de cette vidéo

15 mots de la vidéo à retenir, avec leur prononciation et leur sens :

MotPrononciationSens
pad nom/pæd/tampon, coussinet
align verbe/əˈlaɪn/aligner
correctly adverbe/kəˈɹɛk(t).li/correctement
output nom/ˈaʊtpʊt/sortie
alignment nom/əˈlaɪn.mənt/alignement
architecture nom/ˈɑː.kɪˌtɛk.t͡ʃə/architecture
ignore verbe/ɪɡˈnɔː/ignorer, ne pas prêter attention à
conclusion nom/kənˈkluːʒən/conclusion, fin
consecutive adjectif/kənˈsɛkjʊtɪv/consécutif
structural adjectif/ˈstɹʌk(t͡)ʃəɹəl/structurel, structural
array nom/əˈɹeɪ/éventail
insert verbe/ɪnˈsɝt/insérer, introduire
occupy verbe/ˈɑkjəpaɪ/occuper
attribute nom/ˈæt.ɹɪˌbjut/attribut
byte nom/baɪt/octet

Prononciation à surveiller

  • Les sons « sh » et « zh »: conclusion /kənˈkluːʒən/, structural /ˈstɹʌk(t͡)ʃəɹəl/
  • Mots longs — placez bien l’accent: architecture /ˈɑː.kɪˌtɛk.t͡ʃə/, consecutive /kənˈsɛkjʊtɪv/

Comment s’entraîner avec cette vidéo

  1. Écoutez la vidéo en entier une fois sans parler et notez les mots que vous ne connaissez pas.
  2. Commencez à la vitesse 0,75×, répétez phrase par phrase, puis revenez à la vitesse normale quand cela devient facile.
  3. Enregistrez-vous et comparez avec l’original, en faisant attention à des mots comme pad, align, correctly.

Qu'est-ce que la technique du Shadowing ?

Le Shadowing est une technique d'apprentissage des langues fondée sur la science, développée à l'origine pour la formation des interprètes professionnels. Le principe est simple mais puissant : vous écoutez de l'anglais natif et le répétez immédiatement à voix haute — comme une ombre suivant le locuteur avec un décalage de 1 à 2 secondes. Les recherches montrent une amélioration significative de la précision de la prononciation, de l'intonation, du rythme, des liaisons, de la compréhension orale et de la fluidité.

Technique du shadowing : lire le guide complet étape par étape →