dlang-community / libdparse

Library for lexing and parsing D source code
https://libdparse.dlang.io
Boost Software License 1.0
115 stars 57 forks source link

add RAM/CPU PR comments w/ DCD tests for stats #488

Closed WebFreak001 closed 1 year ago

WebFreak001 commented 1 year ago

analogous to https://github.com/dlang-community/DCD/pull/735

this clones current DCD master and runs its comment script & embeds the content here. This is because libdparse RAM/CPU improvements and general API changes will heavily affect long-running persistent processes such as dcd-server.

codecov[bot] commented 1 year ago

Codecov Report

Merging #488 (df9c61e) into master (98bf0f4) will not change coverage. The diff coverage is n/a.

Additional details and impacted files [![Impacted file tree graph](https://codecov.io/gh/dlang-community/libdparse/pull/488/graphs/tree.svg?width=650&height=150&src=pr&token=VHoPCaUjPZ&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dlang-community)](https://codecov.io/gh/dlang-community/libdparse/pull/488?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dlang-community) ```diff @@ Coverage Diff @@ ## master #488 +/- ## ======================================= Coverage 83.49% 83.49% ======================================= Files 11 11 Lines 8483 8483 ======================================= Hits 7083 7083 Misses 1400 1400 ``` ------ [Continue to review full report in Codecov by Sentry](https://codecov.io/gh/dlang-community/libdparse/pull/488?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dlang-community). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dlang-community) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/dlang-community/libdparse/pull/488?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dlang-community). Last update [98bf0f4...df9c61e](https://codecov.io/gh/dlang-community/libdparse/pull/488?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dlang-community). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dlang-community).
WebFreak001 commented 1 year ago

sample comment:


✅ PR OK, no changes in deprecations or warnings

Total deprecations: 0

Total warnings: 0

Build statistics:

 ------ libdparse statistics ------

 statistics (-before, +after)
-library size=3432236 libdparse.a
-rough build time=19s
+library size=3432324 libdparse.a
+rough build time=18s

 ------ DCD statistics ------

 statistics (-before, +after)
 client size=1055768 bin/dcd-client
 server size=3006064 bin/dcd-server
-rough build time=88s
+rough build time=89s

-DCD run_tests.sh   Elapsed (wall clock) time (h:mm:ss or m:ss): 0:05.90
-DCD run_tests.sh   Maximum resident set size (kbytes): 13128
+DCD run_tests.sh   Elapsed (wall clock) time (h:mm:ss or m:ss): 0:05.98
+DCD run_tests.sh   Maximum resident set size (kbytes): 12304

 short requests: (212x)
-    min request time =     0.009ms
-    10th percentile  =     0.137ms
-    median time      =     0.462ms
-    90th percentile  =     0.880ms
-    max request time =     1.934ms
+    min request time =     0.019ms
+    10th percentile  =     0.128ms
+    median time      =     0.506ms
+    90th percentile  =     0.959ms
+    max request time =     2.041ms

 top 5 GC sources in server:
 bytes allocated, allocations, type, function, file:line
         7438336                454 void[] std.array.Appender!(TokenStructure!(ubyte, "import dparse.lexer:TokenTriviaFields; mixin TokenTriviaFields;")[]).Appender.ensureAddable.__lambda9 /opt/hostedtoolcache/dc/dmd-2.102.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3577
         7421824              80004 void[] std.array.Appender!(DSymbol*[]).Appender.ensureAddable.__lambda9 /opt/hostedtoolcache/dc/dmd-2.102.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3577
         2277376                278 void[] std.array.Appender!(char[][]).Appender.ensureAddable.__lambda9 /opt/hostedtoolcache/dc/dmd-2.102.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3577
         1798144              56192 std.array.Appender!(dsymbol.symbol.DSymbol*[]).Appender.Data std.array.Appender!(DSymbol*[]).Appender.this /opt/hostedtoolcache/dc/dmd-2.102.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3452
-        1384448                590 void[] std.array.Appender!(const(TokenStructure!(ubyte, "import dparse.lexer:TokenTriviaFields; mixin TokenTriviaFields;"))[]).Appender.ensureAddable.__lambda9 /opt/hostedtoolcache/dc/dmd-2.102.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3577
+        1462272                594 void[] std.array.Appender!(const(TokenStructure!(ubyte, "import dparse.lexer:TokenTriviaFields; mixin TokenTriviaFields;"))[]).Appender.ensureAddable.__lambda9 /opt/hostedtoolcache/dc/dmd-2.102.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3577
Full build output ``` DUB version 1.31.1, built on Mar 12 2023 LDC - the LLVM D compiler (1.32.0): based on DMD v2.102.2 and LLVM 15.0.7 built with LDC - the LLVM D compiler (1.32.0) Default target: x86_64-unknown-linux-gnu Host CPU: broadwell http://dlang.org/ - http://wiki.dlang.org/LDC Registered Targets: aarch64 - AArch64 (little endian) aarch64_32 - AArch64 (little endian ILP32) aarch64_be - AArch64 (big endian) amdgcn - AMD GCN GPUs arm - ARM arm64 - ARM64 (little endian) arm64_32 - ARM64 (little endian ILP32) armeb - ARM (big endian) avr - Atmel AVR Microcontroller bpf - BPF (host endian) bpfeb - BPF (big endian) bpfel - BPF (little endian) hexagon - Hexagon lanai - Lanai mips - MIPS (32-bit big endian) mips64 - MIPS (64-bit big endian) mips64el - MIPS (64-bit little endian) mipsel - MIPS (32-bit little endian) msp430 - MSP430 [experimental] nvptx - NVIDIA PTX 32-bit nvptx64 - NVIDIA PTX 64-bit ppc32 - PowerPC 32 ppc32le - PowerPC 32 LE ppc64 - PowerPC 64 ppc64le - PowerPC 64 LE ] }, { "name": "client", "targetType": "executable", "targetPath": "bin/", "targetName": "dcd-client", "excludedSourceFiles": [ "src/dcd/server/*" ] }, { "name": "server", "targetType": "executable", "targetPath": "bin/", "targetName": "dcd-server", "excludedSourceFiles": [ "src/dcd/client/*" ] } ] } { "fileVersion": 1, "versions": { "dsymbol": "0.14.1", "emsi_containers": "0.9.0", "libdparse": {"path":".."}, "msgpack-d": "1.0.4", "stdx-allocator": "2.77.5" } } STAT:statistics (-before, +after) STAT:client size=1055768 bin/dcd-client STAT:server size=3006064 bin/dcd-server STAT:rough build time=89s STAT: STAT:DCD run_tests.sh Elapsed (wall clock) time (h:mm:ss or m:ss): 0:05.98 STAT:DCD run_tests.sh Maximum resident set size (kbytes): 12304 STAT: STAT:short requests: (212x) STAT: min request time = 0.019ms STAT: 10th percentile = 0.128ms STAT: median time = 0.506ms STAT: 90th percentile = 0.959ms STAT: max request time = 2.041ms STAT: STAT: STAT:top 5 GC sources in server: STAT:bytes allocated, allocations, type, function, file:line STAT: 7438336 454 void[] std.array.Appender!(TokenStructure!(ubyte, "import dparse.lexer:TokenTriviaFields; mixin TokenTriviaFields;")[]).Appender.ensureAddable.__lambda9 /opt/hostedtoolcache/dc/dmd-2.102.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3577 STAT: 7421824 80004 void[] std.array.Appender!(DSymbol*[]).Appender.ensureAddable.__lambda9 /opt/hostedtoolcache/dc/dmd-2.102.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3577 STAT: 2277376 278 void[] std.array.Appender!(char[][]).Appender.ensureAddable.__lambda9 /opt/hostedtoolcache/dc/dmd-2.102.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3577 STAT: 1798144 56192 std.array.Appender!(dsymbol.symbol.DSymbol*[]).Appender.Data std.array.Appender!(DSymbol*[]).Appender.this /opt/hostedtoolcache/dc/dmd-2.102.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3452 STAT: 1462272 594 void[] std.array.Appender!(const(TokenStructure!(ubyte, "import dparse.lexer:TokenTriviaFields; mixin TokenTriviaFields;"))[]).Appender.ensureAddable.__lambda9 /opt/hostedtoolcache/dc/dmd-2.102.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3577 ```
WebFreak001 commented 1 year ago

idea why I included DCD here:

the big auto-generated test for UFCS (https://github.com/dlang-community/DCD/pull/733) is currently heavily slowed down by libdparse parsing / AST + quite heavy in RAM usage. So I was thinking that it would be a good candidate to auto-test for RAM & CPU speed changes of everything in the chain, including libdparse (which is currently RAM user #1 in DCD)

I think the many details from DCD might be distracting here though. Thoughts?

vushu commented 1 year ago

I vouch for this, since Im generally in favor for more information for measuring performance.