CppCon 2017: John Lakos “Local ('Arena') Memory Allocators (part 1 of 2)”

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 พ.ย. 2024

ความคิดเห็น • 39

  • @simonfarre4907
    @simonfarre4907 3 ปีที่แล้ว +68

    This is probably one of the best talks ever given at CppCon.

  • @abhishekk4194
    @abhishekk4194 2 หลายเดือนก่อน +2

    The clarity blew me away.

  • @niles_5003
    @niles_5003 3 ปีที่แล้ว +28

    I sincerely hope this man is a professor somewhere. He's an amazing lecturer and definitely someone you want to learn a lot from. I like how he keeps people engaged, manages the room, and even made me laugh out loud all while covering some pretty technical material that's mostly new to me.

  • @hmpcon
    @hmpcon 7 ปีที่แล้ว +16

    Lakos's talks are always a stream of consciousness :P

  • @TimothyJesionowski
    @TimothyJesionowski 6 ปีที่แล้ว +14

    Excellent presentation, very educational while being somehow entertaining. As a C fanboy this is one of the few c++ features I genuinely want, though I'm sure I can kind of get it with stateful functions.

  • @azdinator
    @azdinator 11 หลายเดือนก่อน

    Oh man. That guy is really good. Thank you.

  • @LordNezghul
    @LordNezghul 7 ปีที่แล้ว +6

    Talking "this is very important" should be at the end of part 2 not because "you said so/I am here" but because people already saw this is important.

  • @matveyshishov
    @matveyshishov ปีที่แล้ว

    Pure joy! ❤

  • @АлександрДаас
    @АлександрДаас 3 ปีที่แล้ว +4

    Thank you, great talk

    • @CppCon
      @CppCon  3 ปีที่แล้ว +2

      Glad you enjoyed it!

  • @unevaguejaune8671
    @unevaguejaune8671 5 ปีที่แล้ว +12

    34:25 Can someone explain me what the problem / purpose of the inline specifier is ? Or what he is trying to show ?

    • @SalokinX
      @SalokinX 5 ปีที่แล้ว +3

      He wants to highlight the fact that the function definitions are meant to be
      Inline and that he didn't inline them (by defining the function in the class definition) just so it's easier to see on the slide.

    • @tomcheng3903
      @tomcheng3903 4 ปีที่แล้ว +5

      The functions are inlined by default, so there's no need for the inline keyword - the compiler will error if you try to insert an extraneous 'inline', since it's not possible to have a non-inline allocator.

    • @Jimmy9Bazooka
      @Jimmy9Bazooka ปีที่แล้ว +4

      @@tomcheng3903 Nope. He's lying. You can have extra 'inline' specifier on an inline class function. There will be no error.

    • @jspt256
      @jspt256 หลายเดือนก่อน

      I was also initially deeply confused by this, and none of the comments above were particularly satisfying / filled me with confidence.
      What the c++ reference pages are clear on is that explicitly adding "inline" here is *unnecessary*, because definitions for these member functions are included directly in the class definition (and are therefore already implicitly inline).
      That said, unnecessary does not mean forbidden. I couldn't find from the reference pages whether "inline" is definitely allowed to be specified explicitly or not. Having actually gone to the effort of testing on MSVC and clang, can verify it does not appear to be a "syntax error" to mark those functions inline explicitly (on those compilers).
      It is possible that it isn't technically guaranteed to be allowed in the spec, that the presenter previously worked with some compiler that complained. I don't know, I don't care.
      If you look at the class definition for Allocator, you'll see that the destructor declaration is wrong (should be ~Allocator not ~allocator), which indicates to me that this code was possibly never compiled before the presentation.

  • @IllumTheMessage
    @IllumTheMessage 7 ปีที่แล้ว +3

    Excellent talk.

  • @yb9737
    @yb9737 ปีที่แล้ว

    GREAT TALK

  • @xr.spedtech
    @xr.spedtech ปีที่แล้ว +1

    This guy is cool

  • @PflanzenChirurg
    @PflanzenChirurg 5 ปีที่แล้ว +4

    What a fucking GEM

  • @robbydomino
    @robbydomino 7 ปีที่แล้ว

    great talk

  • @rocknroooollllll
    @rocknroooollllll 7 ปีที่แล้ว +22

    Death by powerpoint, John. Every. Single. Time. You have great talent, but massive information overload.

  • @sampathsubasinghe929
    @sampathsubasinghe929 3 ปีที่แล้ว +1

    49:58 How to determine allocation density is low for billion integers when reserved memory or capacity() is not given.

    • @rastaarmando7058
      @rastaarmando7058 3 ปีที่แล้ว +2

      On my machine vector allocates (1.5 * sizeOfCurrentMemory) each time it runs out of space. should be similar on yours so, I guess u could use that?

    • @mytech6779
      @mytech6779 หลายเดือนก่อน

      Geometric growth with no reserve().
      2^n (GCC and Clang default libraries) or 1.5^n (MS visual studio default library) approximate number of allocations it with log₂N (or log₁.₅N) where N = 1,000,000,000. (30 and 52 allocations respectively.)

  • @andik70
    @andik70 ปีที่แล้ว

    "we meaning me" :-)

  • @marinrusu9179
    @marinrusu9179 6 ปีที่แล้ว

    23:37

  • @mrlithium69
    @mrlithium69 7 ปีที่แล้ว +5

    @56:00 How has he not heard #pragma pack(push, 1).
    You put it around a specific struct, and disable it after w/ #pragma pack(pop)

    • @dyslexicunt
      @dyslexicunt 7 ปีที่แล้ว +1

      Yeah it's always reassuring when someone deemed fit to give a presentation on custom allocators, is completely ignorant of a basic compiler feature dealing with memory alignment. Way to go.

    • @ciaran2679
      @ciaran2679 7 ปีที่แล้ว +50

      I'd imagine it's because this is a talk about standard C++, not compiler-specific extensions.

    • @eggdish
      @eggdish 7 ปีที่แล้ว +4

      I understand not knowing about a non standard pragma and personally I don't like the pragma anyway.
      However, the speaker is clearly misinformed about unaligned data hurting performance, or is programming in non-x86 environment. Google "lemire unaligned x86" for nice blog post with benchmarks. (Might not apply to floating point)

    • @Bozemoto
      @Bozemoto 6 ปีที่แล้ว

      Useful for stuff like loading binary file headers like BMP and WAV though.

    • @andreyblack2558
      @andreyblack2558 6 ปีที่แล้ว

      you just a stupid fool if your think what hi has newer heard about it, its a trick

  • @MsDuketown
    @MsDuketown 9 หลายเดือนก่อน

    arena.h needs a forum.h
    Otherwize, floating atomics will extinguish humanity.