All Projects → drewnoakes → String Theory

drewnoakes / String Theory

Licence: other
Identify and reduce memory used by duplicate .NET strings

Projects that are alternatives of or similar to String Theory

Blog
Our open source benchmarks and code samples
Stars: ✭ 162 (-40.66%)
Mutual labels:  performance, strings
Panko serializer
High Performance JSON Serialization for ActiveRecord & Ruby Objects
Stars: ✭ 266 (-2.56%)
Mutual labels:  performance
Kboom
The Kubernetes scale & soak load tester
Stars: ✭ 256 (-6.23%)
Mutual labels:  performance
Grav
Performance visualisation tools
Stars: ✭ 262 (-4.03%)
Mutual labels:  performance
Poiji
🍬 A tiny library converting excel rows to a list of Java objects based on Apache POI
Stars: ✭ 255 (-6.59%)
Mutual labels:  performance
Hyperhtml
A Fast & Light Virtual DOM Alternative
Stars: ✭ 2,872 (+952.01%)
Mutual labels:  performance
BhimIntegers
BhimIntegers🚀 is a C++ library that is useful when we are dealing with BigIntegers💥💥. We can handle big integers (integers having a size bigger than the long long int data type) and we can perform arithmetic operations📘 like addition, multiplication, subtraction, division, equality check, etc📐📐. Also, there are several functions like factorial, …
Stars: ✭ 43 (-84.25%)
Mutual labels:  strings
Cuerdas
String manipulation library for Clojure(Script)
Stars: ✭ 272 (-0.37%)
Mutual labels:  strings
Stormpot
A fast object pool for the JVM
Stars: ✭ 267 (-2.2%)
Mutual labels:  performance
Fixed
high performance fixed decimal place math library for Go
Stars: ✭ 263 (-3.66%)
Mutual labels:  performance
Deepc
vendor independent deep learning library, compiler and inference framework microcomputers and micro-controllers
Stars: ✭ 260 (-4.76%)
Mutual labels:  performance
Query track
Find time-consuming database queries for ActiveRecord-based Rails Apps
Stars: ✭ 258 (-5.49%)
Mutual labels:  performance
Clang
Mirror kept for legacy. Moved to https://github.com/llvm/llvm-project
Stars: ✭ 2,880 (+954.95%)
Mutual labels:  performance
Rz Go
Ripzap - Fast and 0 allocs leveled JSON logger for Go ⚡️. Dependency free.
Stars: ✭ 256 (-6.23%)
Mutual labels:  performance
Webpack Lighthouse Plugin
A Webpack plugin for Lighthouse
Stars: ✭ 271 (-0.73%)
Mutual labels:  performance
js-utils
A collection of dependency-free JavaScript utilities 🔧
Stars: ✭ 22 (-91.94%)
Mutual labels:  strings
Home
Project Glimpse: Node Edition - Spend less time debugging and more time developing.
Stars: ✭ 260 (-4.76%)
Mutual labels:  performance
React Performance
Helpers to debug and record component render performance 🚀
Stars: ✭ 265 (-2.93%)
Mutual labels:  performance
Next Super Performance
The case of partial hydration (with Next and Preact)
Stars: ✭ 272 (-0.37%)
Mutual labels:  performance
Fastexcel
Generate and read big Excel files quickly
Stars: ✭ 268 (-1.83%)
Mutual labels:  performance

StringTheory

Build Status

Identifies opportunities to improve heap memory consumption by strings.

Finds duplicate strings and provides ways to see what object graphs are keeping them alive.

Once you identify a suspicious referrer, you can query to see what other strings it is holding across the whole heap, and the total number of wasted bytes.

Installation

Download a ZIP file from the GitHub releases page.

Walkthrough

Running the app shows:

Either open a dump file or attach to an existing process. In this example we'll open a dump file from devenv.exe (Visual Studio).

Once loaded you'll see a list of all strings:

This list shows the number of duplicates and the number of wasted bytes due to that duplication per string. You can also see the percentage of each string in the different memory areas (Gen0/1/2 and the large object heap).

In this example we can see that there are 1,924 instances of an escaped path string on the heap. As strings are immutable, we may be able to replace all these copies with a single instance and save 565,362 bytes of RAM on the heap, for that string alone. However we also see many other duplicated path strings, so the savings may be much greater. These strings have also survived long enough to end up in gen2, so are likely long-lived objects.

In order to dig deeper, we need to understand what types/fields are referencing these strings. With that information we can work back and look for ways to intern/pool such strings.

Right click a string and you'll see a context menu:

Selecting "Show referrers" will produce a graph of all references to strings with this value. These are displayed as a tree:

The target string is show at the root, with referrers beneath, forming a tree. You can expand this tree as needed to learn more about the retentiion paths.

This example is relatively straightforward. We see the _definingFileEscaped field of the inner type TaskItem in MSBuild is holding on to all instances of this path string.

This field is probably referencing other strings too, and they're likely to contain duplicates as well. Click the "Show all strings referenced by this field" link to produce a table showing all the strings that are referenced by that field on that type:

Here we see the full impact of duplicate strings held by _definingFileEscaped. From the 10,588 unique string objects there are only 68 unique values. Of the memory allocated for these strings, 97.9% is wasted. Pooling/interning these strings would reduce heap usage by 787,556 bytes.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].