Commit Graph

15 Commits

Author SHA1 Message Date
Sam Rawlins 4ef2725654 Add an analyzer_testing package
We intend to publish and maintain this as a set of testing-related
utilities for the analyzer packages and for analyzer plugins.

Work towards https://github.com/dart-lang/sdk/issues/55660

See the doc: https://docs.google.com/document/d/1jRtd8B1ijPAP6Pz89HRnyIZXw2VMjaZx0vRZTpoNO84/edit?tab=t.0#heading=h.2sz41a544qhi

Change-Id: I2764b1357a932fa955060b26d78038997eaa9536
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425080
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-05-02 06:58:49 -07:00
Sam Rawlins 35e8b9ba0b analyzer: Deprecate ErrorType in favor of new name, DiagnosticType
Change-Id: I552e816de6d526e3476cac9dd3ee2919fc7ec499
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425720
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
2025-04-30 19:07:42 -07:00
Konstantin Shcheglov b2fdd8a345 Elements. Rename XyzElement2 into XyzElement.
The CL was done with rename + adding typedef for each class.

Change-Id: Ia25cc581d2e42cf7d12a85a3579af952d5c232ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424687
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-04-25 13:27:18 -07:00
Konstantin Shcheglov 49599e06cc Elements. Deprecated element2.dart library.
Change-Id: I2be38df49e6f242d9fe59f34164549da4a0f41b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424683
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-04-25 11:23:18 -07:00
Konstantin Shcheglov becd91df17 Format analyzer/ with tall mode.
Change-Id: I410cd1cf63fbf00b868bbb3e060433cad3ac9e6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423520
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-04-21 12:15:58 -07:00
Konstantin Shcheglov 1747e2da4b Elements. Migrate tool/benchmark/heap/flutter_elements.dart
Change-Id: Ie60dbfbba92d9717fb4fb0e3709be2a24f1aa39a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395084
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-13 20:36:01 +00:00
Konstantin Shcheglov 4684ef56dd Element. Don't cache setter name.
Follow up for https://dart-review.googlesource.com/c/sdk/+/381704
I think we  don't need to canonicalize it at all, and pay for map lookup.
If stop doing this, we actually save memory.
My suspicion is that we use setter names transiently.

And removing a field itself save some memory.

Before:
flutter_elements
  reachableObjects
    count: 11865740
      change: -0.01% -1335
    size: 993783127 = 970491 KB = 947.7 MB
      change: -0.01% -72336 = -70 KB


After:
flutter_elements
  reachableObjects
    count: 11861762
      change: -0.04% -5313
    size: 987428847 = 964285 KB = 941.7 MB
      change: -0.65% -6426616 = -6275 KB = -6.1 MB
Change-Id: Iaab513e545862df53ae1f144a7a8b1e695768d06
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386261
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-23 17:26:42 +00:00
Konstantin Shcheglov 57392e8324 CQ. Put TreeStringSink into analyzer_utilities/ to reuse.
Change-Id: I7a1a3e6bc42830b842060fd778a6265ed614f9f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378080
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-07-30 20:32:24 +00:00
Konstantin Shcheglov 0ef8f05c6c Fix 'unnecessary_final' in analyzer/.
But don't enable it yet, pending https://github.com/dart-lang/linter/issues/4938

Change-Id: I42df6e5c2699b08d729518c0565165d81e07ad3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363160
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-04-16 21:46:15 +00:00
Konstantin Shcheglov be5a06874e Update flutter_elements.xml baseline.
Change-Id: I41135bfd747808da09073c99f065495297d91096
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/355886
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-06 00:40:18 +00:00
Konstantin Shcheglov f4080e7ae3 Heap. Drop XyzLinkedData after reading.
All results
--------------------------------
flutter_elements
  reachableObjects
    count: 11774300
      change: -7.92% -1012105
    size: 951741119 = 929434 KB = 907.7 MB
      change: -4.48% -44650680 = -43604 KB = -42.6 MB
  _SimpleUri
    count: 3112
    size(shallow): 248960 = 243 KB
    duplicateCount: 0
  InterfaceTypeImpl
    count: 157899
      change: -0.01% -16
    size(shallow): 10105536 = 9868 KB = 9.6 MB
      change: -0.01% -1024 = -1 KB
  LinkedData
    count: 0
Change-Id: If98590f84d050c7c03d2a5e81d2e23353e7c02ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330382
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-10-16 20:51:02 +00:00
Konstantin Shcheglov c8f8ae8afd Heap. Add --write-file option, print changes relative to the results in the file.
Output example:

All results
--------------------------------
flutter_elements
  reachableObjects
    count: 3487130
      change: -1.19% -41855
    size: 335892119 = 328019 KB = 320.3 MB
      change: -0.58% -1949720 = -1904 KB = -1.9 MB
  _SimpleUri
    count: 3061
    size(shallow): 244880 = 239 KB
    duplicateCount: 0
  InterfaceTypeImpl
    count: 40821
    size(shallow): 2612544 = 2551 KB = 2.5 MB

Change-Id: I371ac4f6c1bf4d70238b47fc9f28bbc3f07abcf6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330244
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-10-13 01:22:29 +00:00
Konstantin Shcheglov c63d228ad6 Heap. Measure InterfaceTypeImpl instances.
The optimization was already done previously.

Before:
--------------------------------
flutter_elements
  reachableObjects
    count: 14531246
    size: 1107667559 = 1081706 KB = 1056.4 MB = 1.03 GB
  _SimpleUri
    count: 3112
    size(shallow): 248960 = 243 KB
    duplicateCount: 0
  InterfaceTypeImpl
    count: 1904467
    size(shallow): 121885888 = 119029 KB = 116.2 MB


After:
--------------------------------
flutter_elements
  reachableObjects
    count: 12839510
    size: 999428703 = 976004 KB = 953.1 MB
  _SimpleUri
    count: 3112
    size(shallow): 248960 = 243 KB
    duplicateCount: 0
  InterfaceTypeImpl
    count: 211922
    size(shallow): 13563008 = 13245 KB = 12.9 MB
Change-Id: Ibcfa0b4c1c61cb074764fb9ed1884086064d24e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330360
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-10-12 19:09:21 +00:00
Martin Kustermann a5ba26babb Make [ByteData] of [Uint8List] based on the same bytes
A [Uint8List] may be a view into a larger buffer. When we want to create
a corresponding [ByteData], we should ensure the byte data is based on
the same bytes (and not e.g. include additional heading/trailing bytes)
by using `bytes.buffer.asByteData(bytes.offsetInBytes, bytes.length)`

Change-Id: Ifd7b59a41b8ee0431319d5cf13a2e63da3dfb00e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330080
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-10-11 14:26:48 +00:00
Konstantin Shcheglov b7d3c47d13 Adds benchmark measuring memory consumption of live objects after analyzing flutter.
Will warm up the memory cache and then measure how much live memory the analyzer consumes after visiting all elements with the warmed up cache.

All results
--------------------------------
flutter_elements
  reachableObjects
    count: 9071480
    size: 799672175 = 780929 KB = 762 MB
  _SimpleUri
    count: 3112
    size(shallow): 248960 = 243 KB
    duplicateCount: 0

Change-Id: I75209f88f6f615172127cd439afe9d0cd83b1c4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329682
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-10-10 17:54:08 +00:00