Browser hacking: Improving JS allocation performance by recycling GC heap blocks

  Рет қаралды 8,808

Andreas Kling

Andreas Kling

Күн бұрын

SerenityOS is open source on GitHub: github.com/Ser...
Discord: / discord
Merch: serenityos.cre...
Follow me on Twitter: / awesomekling
Sponsor me on GitHub: github.com/spo...
Support me on Patreon: / serenityos
Donate via Paypal: paypal.me/awes...
I drink Twinings Earl Grey tea! If you want to order some for yourself, you can support me by using my affiliate link: tidd.ly/3e9TfZG
SerenityOS is a Unix-like operating system that I'm implementing from scratch. serenityos.org

Пікірлер: 35
@agentjeb4103
@agentjeb4103 3 жыл бұрын
There's something very satisfying watching the milliseconds of a benchmark drop down as you code.
@Hendiadyoin1
@Hendiadyoin1 3 жыл бұрын
the best way to optimize memset would be to let the compiler do it, the compiler can do memset unrolls, to just a few mov's when the size is constant, which we sadly cannot do, with the current way contexpr's work, we would need a way to generate code based upon constant arguments, to make it similar to the performance of the compilers implementation tricks
@kneekoo
@kneekoo 3 жыл бұрын
// Timestamps for a busy friend. :) 0:38 Time taken initially by the test-js suite: ~840ms on a hot run (in SerenityOS) 1:52 What takes time in LibJS: heap blocks 2:34 The plan 19:44 Time taken after the first changes: ~780ms (hot run) 22:17 Time taken after more changes: ~540ms (hot run) 24:51 Halving the cache size from 2MB to 1MB averages the time to ~550ms (hot run) 30:05 With Linux, the time taken to complete a test-js hot run is ~540ms
@lawrencemanning
@lawrencemanning 3 жыл бұрын
Hey Andreas. Awsome content as usual! Hope you get to do this fulltime soon. And an amusing observation: while looking at code with KiB in it you uttered kilobyte. Couldn't help but chuckle. Its a kilobyte damnit! :)
@akj7
@akj7 3 жыл бұрын
4:00 Hm i think one way to solve this would be (I am on mobile and won't have access to a PC in the near future to validate this) to go into File>Setting> (That place where CMake is setup, i think is Toolchains or Build Tools) > Add cmake compiler definition: __serenity__ . Reload CMake.
@TimMorgan
@TimMorgan 3 жыл бұрын
Great content as always, and very timely for my own project. Thanks for taking the time to explain your thoughts!
@Sjefke3000
@Sjefke3000 3 жыл бұрын
28:15: About failing early vs limping along: That depends on the use case, maybe. When developing, fail early is definitely the way to notice and then fix bugs. When running on a mars rover or chemical plant, limping along for a bit might be worth it.
@LKokos
@LKokos 3 жыл бұрын
Very satifsfying to see that much time save :^)
@MatheusCostaStutzel
@MatheusCostaStutzel 3 жыл бұрын
Hey Andreas, amazing content as usual. There's one thing that catch my attention, not a big deal, but the block name is used only for a new block. From a api point of view it's seems a little odd to ask for a block with name X and receive a block with name Y. Probably not worth the effort to go back and change this. But I would like to ask you, is there a easy way to "fix" it?
@imalaia8033
@imalaia8033 3 жыл бұрын
Very entertaining video! How can you find those awesome wall papers? :^)
@awesomekling
@awesomekling 3 жыл бұрын
I found this one on 4chan /wg/, in a "post-apocalyptic" thread: boards.4chan.org/wg/thread/7777386
@ZackMitkin
@ZackMitkin 3 жыл бұрын
Good video! Can you do more porting videos too?
@billgatest7563
@billgatest7563 3 жыл бұрын
you always bring it ty
@kidkool27
@kidkool27 3 жыл бұрын
I just noticed your Viking beard haha!
@FreeScience
@FreeScience 3 жыл бұрын
About doing interactive/performance demanding tasks while running heavy background tasks. Have you looked at Ananicy? Originally a python script, but someone have recently rewritten it in c++. It's a profile based demon that applies priority and niceness values to processes.
@po1sonseede9001
@po1sonseede9001 3 жыл бұрын
He’s slowly making his transformation into a world of warcraft character.
@dr.deathvolt3058
@dr.deathvolt3058 3 жыл бұрын
I have question , why # include is working in main function ?
@awesomekling
@awesomekling 3 жыл бұрын
I don't understand the question
@dr.deathvolt3058
@dr.deathvolt3058 3 жыл бұрын
@@awesomekling when I define stdio.h in main funtion, that worked why?
@lawrencemanning
@lawrencemanning 3 жыл бұрын
@@dr.deathvolt3058 probably because studio.h just contains definitions not declarations. You shouldn't do that in any case.
@skillerraptor8669
@skillerraptor8669 3 жыл бұрын
Hey, I wanted to ask what CLion Theme you are using
@KeithRollin
@KeithRollin 3 жыл бұрын
Andreas, if you're worried about spending 1MB on caching these blocks, you could probably recover some of that by first compressing the blocks. And if you zero-fill them first, I bet they'll compress really well!
@FrostBoost
@FrostBoost 3 жыл бұрын
haha, "m.. block.. a-llo-ca-tooor"
@mrkotyuk
@mrkotyuk 3 жыл бұрын
will the interpreter be faster if it is rewritten to pure C ?
@fabse64
@fabse64 3 жыл бұрын
No.
@huw008
@huw008 3 жыл бұрын
A bytecode interpreter would make things faster and allow for more optimisations but hey, one thing at a time. Kling used to work on WebKit, wo he knows his stuff ;)
@yeppiidev
@yeppiidev 3 жыл бұрын
@@huw008 oh wow so he wrote half of the code that's used on safari and chrome (chrome web engine is based on WebKit right?)
@wiktorwektor123
@wiktorwektor123 3 жыл бұрын
@@bjarnestronstrup9122 This is why in game developement more developers are changing to ECS (Entity Component System), where you separate data from code operating on it and you organize the same type of data in conignous memory blocks to avoid as much as possible cache miss hits. Even Unity is swiching to this.
@eccentricsan6019
@eccentricsan6019 3 жыл бұрын
is serenity is based on Linux
@ashtree129
@ashtree129 3 жыл бұрын
No, it’s its own os
@mewhenthemewhenstheme
@mewhenthemewhenstheme 3 жыл бұрын
No, Serenity has its own kernel.
@zeroows
@zeroows 3 жыл бұрын
I love your videos but man do I hate C++
@nnaaaaaa
@nnaaaaaa 3 жыл бұрын
>60fps bueno
@flightvision
@flightvision 3 жыл бұрын
You're also using python as a calculator :)
@sdwvit
@sdwvit 3 жыл бұрын
Hey Andreas, thank you for sharing your work. Have you thought about doing twitch streams live coding? May bring you extra earnings.
Browser hacking: Improving our HTML scripting object model
1:24:01
Andreas Kling
Рет қаралды 7 М.
Browser hacking: A most satisfying refactor to hide constructors
40:23
Just Give me my Money!
00:18
GL Show Russian
Рет қаралды 1,2 МЛН
Or is Harriet Quinn good? #cosplay#joker #Harriet Quinn
00:20
佐助与鸣人
Рет қаралды 53 МЛН
Browser hacking: Let's add JavaScript to the Browser!
1:01:54
Andreas Kling
Рет қаралды 9 М.
Browser hacking: Let's build a simple ad blocker
45:16
Andreas Kling
Рет қаралды 4,9 М.
Browser hacking: Fixing a CSS layout bug found by chessboard.js
1:08:09
Nix explained from the ground up
23:39
Surma
Рет қаралды 16 М.
Browser hacking: Optimizing global variable access in JavaScript
59:44
Compilers, How They Work, And Writing Them From Scratch
23:53
Adam McDaniel
Рет қаралды 178 М.
Become a bash scripting pro - full course
36:00
CODE IS EVERYTHING
Рет қаралды 56 М.
OS hacking: A better main() for SerenityOS C++ programs
57:49
Andreas Kling
Рет қаралды 21 М.
Just Give me my Money!
00:18
GL Show Russian
Рет қаралды 1,2 МЛН