Fireship · @fireship

JavaScript just got way faster

Uploaded July 6, 2022 · Length 3:15

JavaScript just got way faster

Summary

javascript runtime bun announced its first beta release, claiming to be significantly faster than node or dino, with orders of magnitude improvement in performance.

  • javascript runtime
  • bun
  • node.js
  • dino
  • performance
  • javascript engine
  • web development

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:01

    it is july 6 2022 and you're watching

  2. 0:04

    the code report one of the most profound

  3. 0:06

    quotes about the javascript ecosystem

  4. 0:07

    comes from an old british guy who said

  5. 0:09

    out of intense complexities intense

  6. 0:12

    simplicities emerge at the time nobody

  7. 0:14

    knew what the hell he was talking about

  8. 0:16

    but in 2022 it's clear he was

  9. 0:17

    prophesizing the rise of a new

  10. 0:19

    javascript runtime called bun that's

  11. 0:21

    right you no longer need node.js or dino

  12. 0:23

    so go ahead and uninstall those from

  13. 0:25

    your system right now bun just announced

  14. 0:26

    its first beta release and makes the

  15. 0:28

    claim that it's significantly faster

  16. 0:30

    than node or dino not just a little bit

  17. 0:31

    faster but orders of magnitude faster

  18. 0:34

    it's always a good idea to be skeptical

  19. 0:35

    about benchmarks provided by the creator

  20. 0:37

    of a tool but as you can see here it's

  21. 0:39

    about three times faster when server

  22. 0:40

    rendering react running database queries

  23. 0:42

    or executing native code with foreign

  24. 0:44

    functions impressive

  25. 0:46

    very nice

  26. 0:48

    but what i'm more excited about is what

  27. 0:49

    this tool can do to simplify your life

  28. 0:51

    as a developer we'll get into that in

  29. 0:53

    just a minute but first i know my mom is

  30. 0:55

    going to ask me what a javascript

  31. 0:56

    runtime is in the first place you can

  32. 0:58

    think of javascript like gasoline it's

  33. 0:59

    dangerous and bad for the environment

  34. 1:01

    and by itself isn't very useful to make

  35. 1:03

    javascript or gasoline useful it needs

  36. 1:05

    to run through an engine to convert it

  37. 1:07

    into raw energy or machine code for a

  38. 1:09

    cpu the most popular javascript engine

  39. 1:11

    is google's v8 which powers chrome node

  40. 1:14

    and dino and makes javascript execution

  41. 1:16

    extremely fast with just in time

  42. 1:18

    compilation now gasoline combined with

  43. 1:20

    an engine still isn't very useful the

  44. 1:21

    average person wants that engine in a

  45. 1:23

    car with user-friendly apis like wheels

  46. 1:25

    file system access subwoofers websockets

  47. 1:28

    automatic transmission and so on a

  48. 1:30

    javascript runtime is a complete car all

  49. 1:32

    you have to do is put a little bit of

  50. 1:34

    javascript in the tank and it will take

  51. 1:35

    you anywhere you want to go now that

  52. 1:37

    we're done with that ridiculous analogy

  53. 1:38

    let's talk about what makes bun special

  54. 1:40

    a big one is obviously performance but

  55. 1:42

    how does it actually go so fast well

  56. 1:44

    first of all it doesn't use the v8

  57. 1:46

    engine but instead uses javascript core

  58. 1:48

    from webkit which is generally

  59. 1:49

    considered to be faster but more

  60. 1:51

    difficult to work with in addition it's

  61. 1:53

    written in a low level programming

  62. 1:54

    language called zig this is a relatively

  63. 1:56

    new language that's similar to c or rust

  64. 1:59

    and the creators of bun say the lack of