1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 20:18:12 +00:00
serenity/Userland/Applications
Andreas Kling b0b022507b LibJS: Reduce AST memory usage by shrink-wrapping source range info
Before this change, each AST node had a 64-byte SourceRange member.
This SourceRange had the following layout:

    filename:       StringView (16 bytes)
    start:          Position (24 bytes)
    end:            Position (24 bytes)

The Position structs have { line, column, offset }, all members size_t.

To reduce memory consumption, AST nodes now only store the following:

    source_code:    NonnullRefPtr<SourceCode> (8 bytes)
    start_offset:   u32 (4 bytes)
    end_offset:     u32 (4 bytes)

SourceCode is a new ref-counted data structure that keeps the filename
and original parsed source code in a single location, and all AST nodes
have a pointer to it.

The start_offset and end_offset can be turned into (line, column) when
necessary by calling SourceCode::range_from_offsets(). This will walk
the source code string and compute line/column numbers on the fly, so
it's not necessarily fast, but it should be rare since this information
is primarily used for diagnostics and exception stack traces.

With this, ASTNode shrinks from 80 bytes to 32 bytes. This gives us a
~23% reduction in memory usage when loading twitter.com/awesomekling
(330 MiB before, 253 MiB after!) :^)
2022-11-22 21:13:35 +01:00
..
3DFileViewer 3DFileViewer: Propagate key events to the window 2022-11-22 11:23:44 +00:00
About Everywhere: Mark dependencies of most targets as PRIVATE 2022-11-01 14:49:09 +00:00
AnalogClock Everywhere: Mark dependencies of most targets as PRIVATE 2022-11-01 14:49:09 +00:00
Assistant LibGUI+Taskbar+Applets+Applications: Set various windows as Popups 2022-11-19 16:04:42 +01:00
Browser LibWeb: Add 'should block pop ups' user config to Page 2022-11-15 21:48:19 +00:00
BrowserSettings Everywhere: Mark dependencies of most targets as PRIVATE 2022-11-01 14:49:09 +00:00
Calculator Everywhere: Mark dependencies of most targets as PRIVATE 2022-11-01 14:49:09 +00:00
Calendar Everywhere: Mark dependencies of most targets as PRIVATE 2022-11-01 14:49:09 +00:00
CalendarSettings Everywhere: Mark dependencies of most targets as PRIVATE 2022-11-01 14:49:09 +00:00
CharacterMap LibGUI+Applications: Allow GlyphMapWidget's set_font() to fail 2022-11-19 15:41:09 +01:00
ClockSettings Everywhere: Mark dependencies of most targets as PRIVATE 2022-11-01 14:49:09 +00:00
CrashReporter Everywhere: Mark dependencies of most targets as PRIVATE 2022-11-01 14:49:09 +00:00
Debugger Everywhere: Mark dependencies of most targets as PRIVATE 2022-11-01 14:49:09 +00:00
DisplaySettings Userland: Remove workarounds for LibIPC include order sensitivity 2022-11-15 13:25:51 -05:00
Escalator Everywhere: Mark dependencies of most targets as PRIVATE 2022-11-01 14:49:09 +00:00
FileManager FileManager: Improve error handling when posix_spawn() fails 2022-11-04 09:47:30 +01:00
FontEditor FontEditor: Include file basename in error messages when available 2022-11-19 15:41:09 +01:00
GamesSettings Everywhere: Mark dependencies of most targets as PRIVATE 2022-11-01 14:49:09 +00:00
Help Everywhere: Mark dependencies of most targets as PRIVATE 2022-11-01 14:49:09 +00:00
HexEditor HexEditor: Allow keydown events to propagate if they are not handled 2022-11-14 16:08:11 +00:00
ImageViewer Userland: Accept drag_enter events for widgets supporting file drops 2022-11-13 16:13:03 -07:00
KeyboardMapper KeyboardMapper: Call event.ignore() on keydown in the main widget 2022-11-14 16:08:11 +00:00
KeyboardSettings Userland: Remove workarounds for LibIPC include order sensitivity 2022-11-15 13:25:51 -05:00
Magnifier Magnifier+ThemeEditor: Use CommonMenus::make_accessibility_menu() 2022-11-19 11:04:11 +01:00
Mail Everywhere: Mark dependencies of most targets as PRIVATE 2022-11-01 14:49:09 +00:00
MailSettings Everywhere: Mark dependencies of most targets as PRIVATE 2022-11-01 14:49:09 +00:00
MouseSettings Everywhere: Remove unnecessary mutable attributes from lambdas 2022-11-19 14:37:31 +00:00
NetworkSettings NetworkSettings: Add command line option for opening a specific adapter 2022-11-02 12:00:26 +00:00
PartitionEditor Everywhere: Mark dependencies of most targets as PRIVATE 2022-11-01 14:49:09 +00:00
PDFViewer PDFViewer: Take the mousewheel delta into account for scrolling 2022-11-19 15:42:08 +01:00
Piano Piano: Guard against all allocations at top level of the audio pipeline 2022-11-13 19:17:21 +00:00
PixelPaint PixelPaint: Allow keydown events to bubble from ImageEditor 2022-11-14 16:08:11 +00:00
Run Everywhere: Mark dependencies of most targets as PRIVATE 2022-11-01 14:49:09 +00:00
Settings Everywhere: Mark dependencies of most targets as PRIVATE 2022-11-01 14:49:09 +00:00
SoundPlayer Userland: Remove workarounds for LibIPC include order sensitivity 2022-11-15 13:25:51 -05:00
SpaceAnalyzer Everywhere: Mark dependencies of most targets as PRIVATE 2022-11-01 14:49:09 +00:00
Spreadsheet LibJS: Reduce AST memory usage by shrink-wrapping source range info 2022-11-22 21:13:35 +01:00
SystemMonitor SystemMonitor: Add context menu for opening adapter in NetworkSettings 2022-11-02 12:00:26 +00:00
Terminal Terminal+LibVT: Toggle TerminalWidget's focus on input preemption 2022-11-19 16:04:42 +01:00
TerminalSettings Userland: Remove workarounds for LibIPC include order sensitivity 2022-11-15 13:25:51 -05:00
TextEditor Userland: Accept drag_enter events for widgets supporting file drops 2022-11-13 16:13:03 -07:00
ThemeEditor ThemeEditor: Update GML and polish interface 2022-11-19 11:04:11 +01:00
VideoPlayer VideoPlayer: Make PlaybackManager use OwnPtr 2022-11-14 10:05:56 +00:00
Welcome Everywhere: Mark dependencies of most targets as PRIVATE 2022-11-01 14:49:09 +00:00
CMakeLists.txt Escalator: Add new method to privilege escalate within GUI 2022-10-14 11:23:06 +02:00