Browser hacking: Let's hack on the JIT until ai-astar.js SINGS

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

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

  • @awesomekling
    @awesomekling  10 หลายเดือนก่อน +53

    The sound for this video was “enhanced” with Adobe Enhanced Speech. While it removed all the noise and made the voice clearer, there are definitely some glitches.

    • @kreuner11
      @kreuner11 10 หลายเดือนก่อน +3

      Aw mann

    • @-lolus-
      @-lolus- 10 หลายเดือนก่อน

      WHF :-) the voice is super clear, like in anachoic chamber. it sounds a bit wierd as there is no echo/reverb. great video too

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

      I was thinking like wait what is with Andreas voice 😊

    • @thetastefultoastie6077
      @thetastefultoastie6077 10 หลายเดือนก่อน +11

      Minecraft zombie noise at 15:11 😅

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

      it's definitely better on the clarity side, kind of odd tho that there's *no* echo etc? also somewhat monotonic (well, yknow - "more" monotoic).

  • @laesseV
    @laesseV 10 หลายเดือนก่อน +22

    One always learns something new, didn't know the array length property in JS is this magical. Love the series.

    • @blvckbytes7329
      @blvckbytes7329 10 หลายเดือนก่อน +3

      I think that's the only case I ever came accross of a length property that's settable... How do people come up with these ideas 😂

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

      setting the array length is a pretty nice solution if you want to shrink your array, but without wanting to get an array containing your deleted values which is what the splice method does

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

      I've been wondering... how's the speedup from the fast path so high when the profile wasn't showing that high percentage for the array length stuff?

  • @michaelfahey-ww3tq
    @michaelfahey-ww3tq 10 หลายเดือนก่อน +8

    Amazing video and performance speed ups! The first run after the array length fast path from 2.1 to 0.8 was beautiful. 🤯

  • @SimonBuchanNz
    @SimonBuchanNz 10 หลายเดือนก่อน +5

    Array length is even weirder than that, actually: if you set it it changes the array length to that, but it doesn't actually create the elements in-between. If you do that same example in v8, it will print as [, , , ] to make clear that the element slots are not filled. Because reading a missing element still gives you an undefined, this doesn't matter most of the time, until you try to enumerate it with for in /of directly: at which point it will not enumerate any values. Ugh.

  • @msclrhd
    @msclrhd 10 หลายเดือนก่อน +7

    I could see the JIT bytecode becoming unwealdy at some point when covering all the different fast-paths, i.e. each instruction generating a lot of machine code. I wonder what the performance would be like emitting a single jitted routine that is jumped to vs emitting all the fast-path logic each time. Especially if there are multiple heavy instructions in a block.
    Alternatively, it may be interesting to see if checks can be elided/streamlined across instructions. For example, with the simple loop.js you could elide int32 checks in several places, so you would only need to check for overflow. I wonder if it would be possible with the current architecture to front-load the int32 type checks so they are not part of the loop/hot path, or to jump to the point after the types have been checked.

  • @debooger
    @debooger 10 หลายเดือนก่อน +6

    I wish you could revert to the old sound as this video's audio is very unpleasant to listen to, at least to me sounds kinda like low bitrate MP3. Anyway, awesome video as always!

  • @peanut3645
    @peanut3645 10 หลายเดือนก่อน +4

    Awesome video! But sound worse for sure. at 34:02 for example

  • @anewbeginning6632
    @anewbeginning6632 10 หลายเดือนก่อน +4

    How will it be possible to profile the jit machine code that is currently just shown as one block in the profiler?

  • @CYXXYC
    @CYXXYC 10 หลายเดือนก่อน +6

    different mic sound makes you have lower pitch voice because of the missing high formants lol

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

      Yeah, tried using "Enhance Speech" from Adobe after multiple people recommended it. It's definitely a bit different but my voice sounds "clearer" which I like.

    • @CYXXYC
      @CYXXYC 10 หลายเดือนก่อน +8

      @@awesomekling don't know your definition of clear, because it basically chopped off lots of the highs and made it a bit distorted to my ears ¯\_(ツ)_/¯ but tbf both sound clear to me

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

      Yeah sounds weird in this video. Especially 't's sound muffled

  • @RookeRooke-m5t
    @RookeRooke-m5t 10 หลายเดือนก่อน

    This is such a fun series! What do you think about another approach: let the interpreter run but instead of executing each instruction it generates a function call into an in memory C/C++ file. After "interpreting" a JS file in such a way you could get the benefits of an optimizing C++ compiler while also avoiding code duplication as you could just reuse the C++ functions the interpreter is using internally. We just gained A LOT of optimizations for free, avoid duplicate work and can't really introduce bug in the JIT. This needs a moderately fast C++ compiler of course :) This seems very maintanable to me! Keep up the work, it's always a pleasure :)

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

      I believe at one point Apple used LLVM inside JavaScriptCore for exactly that reason.

  • @nightmix
    @nightmix 10 หลายเดือนก่อน +6

    the voice sounds weird? like muffled

  • @aloussase
    @aloussase 10 หลายเดือนก่อน +1

    I personally didnt notice the difference in sound until reading the comments

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

    Really good speed up! Thank you for video ❤

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

    6:14 have any of these others been implemented yet? Also amazing progress so far!

  • @DrBreakalot
    @DrBreakalot 10 หลายเดือนก่อน +3

    10:20 can't you do an identity compare in all cases as a super simple fast path no matter the types?

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

      I suppose you could, but that only covers the case where the values are indeed identical. You still need more specific checks to determine equality in both the true/false cases. :)

    • @PelleReimers
      @PelleReimers 10 หลายเดือนก่อน +4

      Yes, even if the values are identical, they may not compare equal, like NaN. Are there user-definable magical methods in JS as well?

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

      ​@@PelleReimersI don't think you can do operators in JS

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

      @@kreuner11 you can change the behavior of any object with `Symbol.toPrimitive` when using == + - * / ** etc. It's like a less powerful form of operator overloading.

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

      ​@@kreuner11you sort of can with Symbol.toPrimitive / valueOf(). It's pretty constrained, though.

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

    Your desktop wallpapers are amazing! Where do you get them?

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

      I'm making them with DALL-E

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

    Idea: For loose equality, if the bit patterns are the same, then the values must be equal for *any* type. So you could do that check without even looking at the type. Then, if the bit patterns are different, figure out the types and do more checks.

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

      Ah no this doesn't work for NaN :(

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

      @@briancarroll4211 You could do that first and then if they are not equal do the special casing for special types/values like NaN.

    • @gabrielassisbezerra
      @gabrielassisbezerra 10 หลายเดือนก่อน +1

      @@msclrhd NaNs are not equal even if they have the same bit pattern. The NaN check must come first.

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

    👍

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

    Is it me or is your voice quieter than last video? Maybe a result of the adobe edit

  • @xenonbox9393
    @xenonbox9393 10 หลายเดือนก่อน +7

    This filter on you voice sounds like I've got way too much earwax built up. It's kind of unpleasant to listen to. Feels like I got extra pressure in my ears.