Is JSON Blazingly Fast or...?

Поделиться
HTML-код
  • Опубликовано: 27 дек 2024

Комментарии • 789

  • @ginowadakekalam
    @ginowadakekalam 2 года назад +1310

    JSON is like the python of language, slow but convenient to use

    • @ThePrimeagen
      @ThePrimeagen  2 года назад +362

      I think this is the perfect description

    • @worstfellow
      @worstfellow 2 года назад +79

      We want to know more about JSON alternatives

    • @tattipodapatti
      @tattipodapatti 2 года назад +58

      @@worstfellow Yes, but definitely not XML

    • @nature-.
      @nature-. 2 года назад +49

      @@tattipodapatti yes even non programmers can understand JSON easily, government of india is using it in websites like income tax for the users to download as json

    • @guruji-.
      @guruji-. 2 года назад +26

      @@codyking9491 yes already we have too many javascript frameworks don’t want too many data formats 😅

  • @MrMw1979
    @MrMw1979 2 года назад +470

    Great video. Thanks for introducing me to Deku.
    I think there is a lot of information left out here. I'm gonna outline my opinions below even if they don't matter:
    1. JSON is not for computers it's for humans. Trouble shooting binary requests isn't easy.
    2. GZIP compression can greatly reduce the bytes over the wire. JSON with lots of repeating keys can greatly benefit from gzip.
    3. A lot of the time the database is your actual bottleneck and serialization doesn't matter for performance. In fact, 1,600 requests per second is more than most companies/services will ever see.
    4. Having the document define the schema allows for flexible data. You can't just send arbitrary data with a binary protocol. This has pros/cons.
    For a public facing web service that only receives a couple thousand requests per second I would pick JSON over any other structured binary protocol almost every time. Yes there is a cost to simplicity but there is also a cost to complexity. Make it easy for internal (engineers) and external (users) to troubleshoot. Just use JSON unless you have identified that serialization is the bottleneck in your endpoint.... For most endpoints/services, I would wager serialization is not the bottleneck.

    • @vaisakh_km
      @vaisakh_km 2 года назад +31

      things like scientific applications involving high density of data collected in small amount of time(rocket controls, explotions tests..), and things that are inherintly binary(vnc), JSON is not a good choice
      anything involving man, it's good to use JSON

    • @evasiveutopian
      @evasiveutopian 2 года назад +51

      to your 3rd point. It was even greater 1,600 requests per milliseconds ~ which would be 1,600,000 requests per second

    • @alkolaqi83
      @alkolaqi83 2 года назад +2

      on point

    • @odnoletkov
      @odnoletkov 2 года назад +28

      Comments like this keep my hope in the humanity

    • @thekwoka4707
      @thekwoka4707 2 года назад +3

      Why gzip when we can Brotli?

  • @ThePrimeagen
    @ThePrimeagen  2 года назад +21

    Hey, did you like the video? I really enjoy making this kind of content. That's fun. Do you think I should do something with promises? (MAKE A COMMENT, Do not respond, RUclips has the worst notifications)

  • @CemKavuklu
    @CemKavuklu 2 года назад +582

    These videos are getting better and better both in quality and entertainment factor :)

    • @ThePrimeagen
      @ThePrimeagen  2 года назад +88

      That's what I like to hear

    • @vaisakh_km
      @vaisakh_km 2 года назад +4

      @@ThePrimeagen to bad you cannot 'hear' that...
      unless you made a speech to text app in RuSt... :)
      edit: text to speech

    • @oliverchalkley1187
      @oliverchalkley1187 2 года назад +6

      @@vaisakh_km if he had then it would have been blazingly fast

  • @scottiedoesno
    @scottiedoesno 2 года назад +162

    BLAZINGLY SLOW. Thanks for another great technical video! I hadn't actually thought about it until now, but this explains perfectly why we use protobuf so much in embedded work

    • @ThePrimeagen
      @ThePrimeagen  2 года назад +28

      Absolutely. By the way, I haven't responded to your discord message. I'm on a flight to meet my boss right now, and then I'll be able to update you

    • @scottiedoesno
      @scottiedoesno 2 года назад +7

      @@ThePrimeagen Thanks a ton. Have a safe flight and hope the meeting goes well

    • @destinyinskyx
      @destinyinskyx 2 года назад +11

      @@ThePrimeagen you have a boss? thought ur the boss

    • @dickheadrecs
      @dickheadrecs 2 года назад +4

      blazingly slow is the new blazingly fast

    • @DaddyFrosty
      @DaddyFrosty Год назад +3

      @@dickheadrecs I just heard that sentence with Fireships voice thanks for making my day

  • @DelaoOliveira
    @DelaoOliveira 2 года назад +50

    It would be nice to see a video comparing sending JSON/XML/Apache Avro/Protobuf over the wire with Rust/Go/JS. Great video, as always;

    • @ebrelus7687
      @ebrelus7687 2 года назад +1

      Absolutely must happen

    • @es68951
      @es68951 2 года назад +5

      For sure. I am also curious why “deku” instead of using exactly Avro or Protobuf. This approach doesn’t seem to take into account forward/backward compatibility, unless I missed something?

  • @alexgochenour8740
    @alexgochenour8740 2 года назад +26

    I can't stop loving this content. JSON is something I use daily but never really think about. A deeper than usual deep dive, yet still accessible. Thank you my good man

  • @dealloc
    @dealloc 2 года назад +36

    Binary formats are difficult to maintain and scale at certain points, as ThePrimeagen notes, it's also not easy to version; you'll have to change your parser to read data correctly, or know where to take up unused space to give room for future improvements without breaking the protocol.
    But it's really good for real-time systems that need to deliver a lot of data in a small amount of time. For example game servers where feedback should be fast and responsive both on the client and across other clients with different network conditions at 60fps, while also dealing with other systems like rendering.

    • @ko-Daegu
      @ko-Daegu Год назад +1

      Protobuf then?

  • @localboxcrox
    @localboxcrox 2 года назад +2

    i love that akame wallpaper behind your transparent terminal with nvim open. nice touch.

  • @filipebraganca2558
    @filipebraganca2558 2 года назад +40

    It kinda landed right at the best moment, as I'm trying to improve the performance of our microservices where are transferring millions of JSON messages and can see the real cost of JSON serialize/deserialization growing super fast. I was studying GRPC and just learned about this protobuf here, thanks again for sharing this kind of content!!!

    • @asdqwe4427
      @asdqwe4427 2 года назад +5

      GRPC is wonderful. And reading the proto files is so much better than working with swagger

    • @Ether_Void
      @Ether_Void Год назад +8

      There is actually a successor to GRPC & Protobuf called Cap’n Proto.
      Afaik it's made by the same person but they are no longer working for Google. It's faster because Cap'n Protos RPC can "travel back in time" (send a rpc using the output of a another call before the call has even finished) and it does direct in-memory modification rather than adding extra encoding & decoding steps.
      You of course keep the benefit of having a separate protocol definition that can be used across multiple languages.

    • @ko-Daegu
      @ko-Daegu Год назад +5

      @@Ether_Void “before call is even finished” sounds cool but also scary this rings so many alarms in my head as a security analyst

  • @za_wavbit
    @za_wavbit Год назад +3

    "This data transfer specification is slower than writing non-interchangeable data structures in my preferred language" yeah of course, and also of course it's less space-efficient (and slower to parse) than all the various binary formats (but see also gz). JSON is human-readable, available in every language, and good enough for most use-cases (except at FAANG scale); no one ever accused JSON parsers of being particularly speedy, but also most systems don't have JSON parsing as a bottleneck. I ran into this at a previous company, they wanted to switch to protobuf or something similar to save some bytes, and I had to call out that they had some terrible queries in common paths that took over 5 seconds to complete, and needed to focus on real problems. And about the last quip: if we got rid of JSON today, some idiot with a popular blog would say it's time for XML to make a comeback, and then we'd really be in deep shit.

  • @js-ny2ru
    @js-ny2ru 2 года назад +36

    Recently I was comparing Deno and Rust. What surprised me was how much simple JSON response weigh...

    • @ThePrimeagen
      @ThePrimeagen  2 года назад +33

      People just don't realize how expensive simplicity is

    • @enclave2k1
      @enclave2k1 2 года назад +2

      @@ThePrimeagen I'm a simple man; consequently, an expensive one as well.

    • @notsojharedtroll23
      @notsojharedtroll23 2 года назад

      @@enclave2k1 xd

  • @headlights-go-up
    @headlights-go-up 2 года назад +10

    Really enjoyed this. It just seems like, for better or for worse, the ease and convenience of JSON trumps everything else.

  • @alexandrosvangelatos9979
    @alexandrosvangelatos9979 2 года назад +1

    Love your videos dude!
    What's with the dancing squirrel 💃🐿️?
    🤣🤣🤣
    Good one!

  • @Omikronik
    @Omikronik 2 года назад +9

    I interned at an insurance company where the way they received new insurance data was through a single string that was about 5000 characters long and parsed it by slicing that string at intervals and it almost always caused issues with encoding because it used ascii encoding and all the responses were in utf-8 so it had a billion safeguards that would always break when someone entered a non ascii character.
    I'd say it doesnt get more blazingly fast than this but its written in the most cursed and blazingly slow C# code ive ever seen in my limited experience. Best part is they moved to c# from java like 7 years ago but just kept this system instead of rewriting it to use xml or "jizzle"

  • @arkayv
    @arkayv 2 года назад +21

    I think JSONs fall into the same pitfalls as document storage DBs. They are so easy to understand and implement, yet so goddamn hard to let go off even after you learn about better and BLAZINGLY FAST-er alternatives (like good ol' postgres or protobufs in this case). This requires a change in mentality more than anything. I suppose old habits die hard.

    • @ThePrimeagen
      @ThePrimeagen  2 года назад +15

      Exactly. Simplicity is amazing. I cannot stress that enough. But it also costs a lot.

  • @drilkus1312
    @drilkus1312 2 года назад +1

    Crazy timing. My frontend team at work is frequently wondering why we're not doing JSON payload, so i can send this! Super informative, thanks!

    • @ThePrimeagen
      @ThePrimeagen  2 года назад

      hah! well if your backend is dictating it, they are smert

  • @diegolikescode
    @diegolikescode 2 года назад +168

    Prime, these videos make us all better programmers. Thank you so much, I have been so much healthier programming and having fun doing it just because of your content, and that makes me a much better programmer

  • @asdqwe4427
    @asdqwe4427 2 года назад +31

    Very cool video 😎
    Would be interesting to see jsons position challenged. I wonder how gRPC would compare, as I have never used it in the browser. But, before we hate on JSON, let’s remember that it freed us from XML

    • @TesterAnimal1
      @TesterAnimal1 2 года назад

      It didn’t really.
      All these horrible front end “frameworks” go through linguistic and development hoops to preserve XML.
      UIs are defined in some bastard munged XML+JS format that can’t be merged.
      UIs can be described in JSON.
      But a bunch of HTML authors from 1994 still want to do

    • @ABaumstumpf
      @ABaumstumpf Год назад +2

      Yeah, it "freed" us from a more structured approach that also supports comments and validation....

    • @lunafoxfire
      @lunafoxfire Год назад

      @@ABaumstumpf you dont need to send comments over API requests, lol. XML is fine for a lot of cases if you like it, but it makes no sense to use it for network traffic.

    • @ABaumstumpf
      @ABaumstumpf Год назад

      @@lunafoxfire "you dont need to send comments over API requests"
      Who said anything about API request??
      "but it makes no sense to use it for network traffic."
      Then that applies exactly the same to Json.

    • @lunafoxfire
      @lunafoxfire Год назад

      @@ABaumstumpf ...the whole video was about network traffic... ...thats what the original comment was about...

  • @waylag9144
    @waylag9144 2 года назад +1

    I'm loving the new editing style. not too much but just the right amount of sass

  • @camillenovak8359
    @camillenovak8359 2 года назад +1

    These types of videos are super valuable and I really appreciate the way you go into the technicalities and explain these topics. Loving the format!

  • @paulgupta2454
    @paulgupta2454 Год назад

    been watching a lot of your videos, I feel like your newer 'hot take' videos on blogs are fine and all, but you're a good teacher and I'd like to see more of these more informative/objective vids from you because you're a pretty good teacher when you do this sort of content!

  • @kortes8914
    @kortes8914 2 года назад +1

    Your production quality has gone up and the humor is on point. Today I decided to subscribe! I can officially say that I like this channel now :) great content my dude!

  • @Dayun123
    @Dayun123 2 года назад +1

    Absolutely loving these performance deep dives! Keep ‘em comin!

  • @christophergruendell8089
    @christophergruendell8089 Год назад

    The lab coat and theme when you went all sciency gave me serious Garand Thumb vibes. I love it. You guys even kind of look like each other.

  • @KroshkaMu
    @KroshkaMu Год назад +1

    I want an update of this video, this time featuring JDSL and Tom the genuous

  • @stryhx
    @stryhx 2 года назад +1

    damn! that sub request was really well placed and timed! nice one!

  • @Sakrosankt-Bierstube
    @Sakrosankt-Bierstube 2 года назад +2

    The deserialization from json from the requests and the database to serialization to the response are actually in the top 5 of our bottlenecks in the company i work in. 40ms of a 100ms request are just for de-/serialization from/to json.

    • @ThePrimeagen
      @ThePrimeagen  2 года назад +1

      That is incredible. And if you're using a garbage collected language, don't forget the effects of garbage collection.

    • @Sakrosankt-Bierstube
      @Sakrosankt-Bierstube 2 года назад

      @@ThePrimeagen Well, we use Java so... yeah.. xD

  • @federicocarboni2414
    @federicocarboni2414 11 месяцев назад +1

    It's not apples to apples though, JSON is (generally) schema-less, while the simple binary format showed has to know the structure of the data before it can even parse it. If say fields are added later an outdated client might just parse garbage values not knowing how the new data is layed out. Yes you can version data correctly yourself or use good tools like protobuf. And for the size complaints, JSON is usually served gzipped so a lot of repeated " , {} [] won't really matter. I'd like a comparison with gzipped data, text compresses very well so it will get closer to binary.

  • @reegnz
    @reegnz 2 года назад +7

    What about gzip, brotli, etc? I don't worry too much about json size overhead as long as the client supports compression (especially brotli).

    • @nrwchd
      @nrwchd 2 года назад

      i think you fall a sleep during the video
      parsing json is slow

  • @yxtqwf
    @yxtqwf 2 года назад +2

    I think another benefit of JSON (though it may not be as relevant in this example as in, say, a web application) over any binary format is that it is immediately readable to any user. I can't count the number of scripts or alternative clients I've been able to write just by inspecting the JSON data a website sends. A universal, plain-text format like JSON frees the potential of how software is used from just the developer and places some choice in the hands of the user as well.
    Another thing, I've found that I really like the TSV (tab-separated values) format for storing any tabular data. It's so simple, effortless to parse, and much more compact compared to JSON or even CSV (the schema is usually just the first line, or can even be omitted). I'm not sure how it would work as a data transfer format, and though I don't see it commonly used, I doubt there would be any significant problems.

  • @echobucket
    @echobucket 2 года назад +5

    As someone who tried writing this kind of stuff back before JSON and even before XML, the reason we went with this stuff was for debugging purposes. At the time it was so nice to just watch the stuff on the wire, and be able to have it be human readable. However, I would argue this was mostly because there was not a de-facto binary protocol well understood by common tooling. I think it's entirely possible for us to have a nice binary encoding that our tooling (things like wireshark, Charles proxy, Chrome dev tools) could read and understand without it being fat and bloated like JSON.

    • @שחרכהן-ס7ר
      @שחרכהן-ס7ר 2 года назад

      This

    • @billeterk
      @billeterk 2 года назад

      Insert obligatory xkcd standards cartoon here ;-)

    • @phoenix-tt
      @phoenix-tt Год назад

      I guess it would be really beneficial for the adoption of protobufs as well, if you could just upload a .proto to devtools and see all the underlying data

  • @mdfalexis
    @mdfalexis 2 года назад +1

    This is an algorithmic message to let you know that this type of content is really really appreciated !

  • @WilliamCulver
    @WilliamCulver 2 года назад

    I don't know how I got here guy, but I'm absolutely glad to be here - some slick vim keystrokes, nice editing and explanations. Keep it coming good sir.

  • @shahabqamar13
    @shahabqamar13 Год назад +1

    0:24 its used by Tom The Genius Jay-Diesel

  • @metalpachuramon
    @metalpachuramon Год назад +2

    Maybe try with gson? Memory-wise it'll use roughly the same amount of memory but speed-wise, I think it'll definitely do better + the readability + the embedded schema

  • @tibixdev
    @tibixdev 2 года назад +2

    This was a really cool deep-dive, but also very entertaining and straight to the point. Looking forward to more stuff like this. :)

    • @ThePrimeagen
      @ThePrimeagen  2 года назад +6

      I think I could have done a better job and got a bit slower on binary representation. But, it's such a hard balance to not be long-winded, but be entertaining.
      So thank you for the note!

  • @zyriab5797
    @zyriab5797 Год назад +1

    I'd just like to interject for a moment. What you're referring to as Json,
    is in fact, JSML, or as I've recently taken to calling it, Tom is a genius.

  • @rafaelgil6895
    @rafaelgil6895 2 года назад +3

    I'm, just using "edn" (extensible data notation) by default since it's not only "blazingly" but also "extensibly" fast :D
    Amazing video btw, like always!

  • @MohitDodhia
    @MohitDodhia 2 года назад

    had to pause at the intro just to mention how smooth that subscriber plug was. ggwp
    edit: what a great video

  • @moodynoob
    @moodynoob 2 года назад +1

    Loving this series! This is great content covering topics that aren't too easy to find, most of YT is for junior devs.

  • @sunnyheheheh9401
    @sunnyheheheh9401 2 года назад

    Your jokes in this type of developer/programming videos is funny and unique and I would love to see more of em keep up the good work.

  • @thehibbi
    @thehibbi 2 года назад

    Very informative and comedic video, thanks :) Keep up the good work TheScienceagen

  • @drborisyum9977
    @drborisyum9977 2 года назад +2

    Love this form of content Prime! 👍 You make harder concepts (for me anyway) as digestible as possible! So invaluable.

  • @gayedemiray
    @gayedemiray Год назад

    insanely high quality video. thank you for all the information!

  • @GeekMasher
    @GeekMasher 2 года назад +2

    Amazing video as always, please keep them up!

  • @laupetre
    @laupetre 2 года назад

    I really enjoy these comparison videos, especially with your humor.

  • @blarghblargh
    @blarghblargh Год назад

    There's a Handmade Seattle talk from 2021 called "context is everything" that shows you can get huge speedups if you can tighten your schema, and if you have full control over your tools that do the parsing (down to using native code).
    JSON imposes a tax in comparison to raw bytes, but you can still get big gains if you can tighten down your schema.
    Thinking JSON/not JSON in black and white will cost you orders of magnitude. You should consider if you actually need the flexibility of wide-open generic constrains on either the parsing or the generation side.

  • @calder-ty
    @calder-ty 2 года назад +2

    Love these style videos. Keep it up!

    • @ThePrimeagen
      @ThePrimeagen  2 года назад +2

      Thank you. I feel like it's a fun break from the VIM content

  • @dandreani
    @dandreani 2 года назад +2

    having just seen Mark Robber's last Olympiad for squirrels. I can appreciate the squirrel for science...

    • @ThePrimeagen
      @ThePrimeagen  2 года назад +2

      Science squirrels are incredibly important

  • @HYPERLOG__ARCHIVE
    @HYPERLOG__ARCHIVE 2 года назад +1

    0:08 made me laugh way too hard, thank you Mr. Prime

  • @gaeel330
    @gaeel330 Год назад +1

    "The schema is within the JSON" can be a feature sometimes (maybe?). I'm wondering if there are formats where the schema can appear in the header, and then the data is just packed binary.

  • @7xr1e20ln8
    @7xr1e20ln8 2 года назад

    Dude this guy is on another level. Love your videos.

  • @zeachco
    @zeachco Год назад

    I just love your content, it's smart, useful, in dept and quite entertaining!

  • @ahmedeatsplanets
    @ahmedeatsplanets Год назад

    This is one of the best videos on programming I've ever seen. I feel enlightened and empowered

  • @mariumbegum7325
    @mariumbegum7325 2 года назад

    Great video, some interesting points mentioned here. Looking forward to seeing more

  • @pemedeiros
    @pemedeiros 2 года назад +1

    For more information on that topic I recommend chapter 4 of Designing Data-Intensive Applications. Really good video :D

  • @victorvirgiliocalderonsoto8689
    @victorvirgiliocalderonsoto8689 2 года назад

    I loved this video! Thank you Primeagen

  • @camenraidercc6625
    @camenraidercc6625 2 года назад

    Hi Man! So it's been a couple of weeks since you started to appear in my recomendations, for some reason RUclips is suggesting me all your VIM videos, now i don't give a damn about VIM and i didn't found the thumbnail any interesting so i decided to ignore it, but today it suggested me this one....so i watched it.....and now i've watched almost all of your videos :D
    This is very good and entertaining content, keep up the good work ( i'm still not gonna watch the VIM videos btw )

  • @vishvish8549
    @vishvish8549 Год назад

    This is fantastic. Would you be able to share the testing setup you had to compare JSON and DEKU?

  • @nordern1
    @nordern1 2 года назад +2

    Human readable, dynamic formats are not binary. I am shook. I agree that people often use JSON where they don't really need a human readable format, but they have their place. I would actually be interested if there are human readable formats that are much faster to parse/generate.
    Also 10x difference is surprisingly low. Like, we are comparing a format that needs to be parsed to something that basically can get flushed straight to memory. JSON seems pretty amazingly fast for what it does

    • @ThePrimeagen
      @ThePrimeagen  2 года назад +1

      It was the smallest message I could send. As a message grew the performance got closer to 40 to 100x. Remember I'm also fully parsing the message. This isn't flat buffers where it lazily parses message access
      At that point you're talking a thousand x

    • @nordern1
      @nordern1 2 года назад

      @@ThePrimeagen Fair point

  • @wety789
    @wety789 2 года назад

    I love this style of video! The live stuff is neat as well but I find these are much easier to focus on

  • @playea123
    @playea123 2 года назад

    This is awesome! More of these deep dives please!!

  • @BlueeyesChineseguy
    @BlueeyesChineseguy 2 года назад +21

    For the algo

  • @fabianschwarzfritz
    @fabianschwarzfritz 2 года назад +2

    I like this format! Could be even a bit deeper / more technical and longer :). Anyway, super cool format!

  • @rhinni
    @rhinni 2 года назад +1

    I read somewhere that when in JS you want to init with a lot of object data, it's faster to JSON encode it and then let JS JSON decode it, just because JSON parsing parsing is faster than letting the JS parser parse all the object data on loading the page/script.

    • @jeremykothe2847
      @jeremykothe2847 2 года назад

      That is true, similar to how it is faster to use element.innerHTML = "...." than programatically add a div, set properties etc. But it's still faster to use a binary format (done properly).

  • @u9vata
    @u9vata Год назад

    Binary protocols often do some kind of chunked data structure that supports versioning the protocol nicely. I mean only as nicely as json can do in that things that are new and not supported in your version are just ignored, offsets are not hardcoded, etc. yet size is smaller, but some very little parsing is needed though...

  • @TheyCallMeIce
    @TheyCallMeIce 2 года назад +2

    Deku looks interesting, but it also looks like it was made for transferring objects of a known structure, and mainly size. Like, what if an object contains an array of an unknown size? Or even simpler, how do you transfer strings?

  • @vedrankaracic265
    @vedrankaracic265 2 года назад +1

    Love these videos! Keep 'em coming!

  • @Guilherme-qk9so
    @Guilherme-qk9so 2 года назад

    your technical videos are so good!

  • @adelarsq
    @adelarsq 2 года назад

    I don't even work with Rust and NodeJS, but it's pretty fun your videos. Keep going!

  • @JanKammerath
    @JanKammerath 2 года назад +1

    Anyone else currently looking at a JSON parser and your head constantly screaming "Jéson!"?

  • @blackfrog1534
    @blackfrog1534 2 года назад

    yah yahh, prime is on a roll!
    This is the best tech content on the internet if you ask me. Would be delighted if you pumped up even more of these.
    Plus the streams were you write the code for these experiments are so much fun :)

  • @crashingflamingo3028
    @crashingflamingo3028 2 года назад +3

    Can you make a video about CBOR, the binary JSON alternative?

  • @adam8685
    @adam8685 2 года назад

    Love this type of video, I wasn't aware of Deku before watching. I'd be keen to see a breakdown of Protobuf vs Deku
    We used Twitch's Twirp framework for Golang at a previous company I worked at for exactly this reason

  • @muhamedkarajic
    @muhamedkarajic Год назад

    Exactly what I was looking for. Thank you!

  • @0e0
    @0e0 10 месяцев назад

    I really love this sort of content from you

  • @lastink444
    @lastink444 2 года назад

    MY GOD, this was so satisfying to watch and listen to

  • @m4rt_
    @m4rt_ 2 года назад

    9:05 Though you can use the content-type header for this,
    for json it is "application/json" if you set it to something saying it is using deku, then people/servers would know that it is using deku

  • @aus10d
    @aus10d Год назад

    this was really beneficial and interesting. thanks for posting it. i learned a lot

  • @Winnetou17
    @Winnetou17 2 года назад +1

    Hey, I clicked that weird red button that says SUBSCRIBE on it and indeed, there were multiple AJAX calls that were using JSON for BOTH request parameters and response data. Crazy!

    • @ThePrimeagen
      @ThePrimeagen  2 года назад +2

      Weird. This Json thing might just catch on after all

  • @digicyc
    @digicyc Год назад +1

    I absolutely vote for more videos like this, but maybe some more involvement in the creation of the code. Loving it! SO much JSML o_O

  • @yoni532s9M5w
    @yoni532s9M5w 2 года назад +1

    One of the easiest subscribing of my life, top notch quality

  • @MattWyndham
    @MattWyndham 2 года назад +1

    JSON maximizes readability, whereas deku maximizes speed. Same tradeoff between Rust and Python

  • @ToukiMS
    @ToukiMS 2 года назад +4

    As a french dev, hearing you say "jason" makes me giggle in the weirdeist way 😅
    Your more technical videos are so great, kudos !

    • @ThePrimeagen
      @ThePrimeagen  2 года назад +1

      Will do, and I will never let JSON be said any other way

  • @st-jn2gk
    @st-jn2gk 2 года назад

    W video, more more more. Too many videos out there aimed at beginners, very few aimed at intermediates (other than theo and fireship). Love the content. Love the streams. Good job dad.

  • @robinbauhn8685
    @robinbauhn8685 2 года назад +5

    Would be interesting to see comparison between deku and MsgPack since it sits somewhere in between binary and json

  • @TownspersonB
    @TownspersonB 2 года назад

    This was very interesting and something I hadn't really given second thought to when I'd use JSON

  • @quintondeanmusic
    @quintondeanmusic 2 года назад +1

    Great video. Super interesting to see! The “XML is worse” part got me in kidneys. I have to work with shitty XML everyday as a messaging schema between our app and other companies integrations (LEGACYYY). Slow and terrible to work with. The worst of both worlds.

  • @heliobessonirodrigues6632
    @heliobessonirodrigues6632 2 года назад +1

    You missed the point. Binary representations are not flexible. You need to read properties in the exact order they are written. You can't add new properties in old data. You can't query them without the schema, which will be external and won't be provided with the data. You can't read data without the schema, if there are many versions of that schema, you're in trouble. If you update the schema, you have to update the consumer, even if the modification is backward compatible.

  • @sammysheep
    @sammysheep 2 года назад

    Excellent work, Dr. Prime!

  • @focusEngineered
    @focusEngineered Год назад

    I loved this idea, And this is the first time I see how slow is JSON, I never thought about it before
    Thanks for the great ideas and videos, Please keep up the good work
    I love watching your videos, it is useful, funny and interesting to me

  • @MrBaudin
    @MrBaudin Год назад

    Great video, please do more subjects in depth. These nuggets of knowledge help us all! Thank you.

  • @mosslightstudio
    @mosslightstudio 2 года назад

    love it when the scienceagen comes in to do some blazingly fast research for us all

  • @rubenverster250
    @rubenverster250 2 года назад

    I really love your work man. You're the Senior I'd aim to become ^-^

  • @s0er3n33
    @s0er3n33 2 года назад +2

    but my eyes can read json blazingly fast

  • @MantasJurkuvenas
    @MantasJurkuvenas 2 года назад +40

    As an embedded C engineer i love efficient code. I think JavaScript is the evidence of the decline of our civilization.

    • @ThePrimeagen
      @ThePrimeagen  2 года назад +7

      Facts

    • @andersoncunha7079
      @andersoncunha7079 Год назад +7

      looking at the comments: seems most people consume messages without checking what they are ingesting (some even say that is the safe way), never heard of network endianness, didn't realize a few bits in the beginning of the frame can specify version, size and any other desirable property, don't know what rpc is, think computers should communicate in human, and the list goes on... so I think you are right.

    • @virtuosisimo
      @virtuosisimo 11 месяцев назад +1

      I'm with you man, I have an embedded arm Linux mature project I recently spend some time optimizing code that the GCC profiler marked as high usage.
      There is some json in the project, this video makes me want to rethink it, so the device runs more cool, other people don't this beneficial, but I don't see the benefit of heating the atmosphere

    • @KevinJDildonik
      @KevinJDildonik 3 месяца назад

      ​@@andersoncunha7079 Who cares? 99% of devs are probably working stuff like web dev. Yeah we want the router and the actual webserver itself to be internally optimized to the femtosecond. But the website? Bro people are loading sites on their phones. If it takes a couple seconds, who cares? What matters is if it's maintainable. JSON is maintainable. And before you say "but you can break it with version updates" yeah and it just causes an image not to show on a website. It doesn't crash an airplane into the ground. Different applications bro.

    • @gamechannel1271
      @gamechannel1271 3 месяца назад

      The fact that there are a million different Javascript frameworks invented every day shows that the productivity boost and portability benefits that Javascript gives you are real.

  • @andrewwashburn9357
    @andrewwashburn9357 Год назад

    When liking your video I opened the network tab and inspected the ja-sean request. The request header contains a 'context', params, and target which is the video id. The response just contains a "responseContext" with 2,783 bytes. Although small, it is more than a simple http status code. I wonder how "cheap" storage and transmission causes useless network traffic?

  • @theuidawg3274
    @theuidawg3274 2 года назад +2

    Great video. Does the verbosity of JSON affect the file size of requests once they are gzipped?

    • @that_tabby
      @that_tabby 2 года назад +1

      Yes, gzip just compresses it to hell but it still need to compress the keys and syntactic stuff like quotes, colons, etc.

  • @nikensss
    @nikensss 2 года назад

    Loved it, thanks for this type of videos