﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Ayende Rahien commented on String Interning: The Garbage Collectible way</title><description>Hernique,
  
I would NEVER do something like that
</description><link>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment15</link><guid>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment15</guid><pubDate>Wed, 06 Jan 2010 22:03:27 GMT</pubDate></item><item><title>Henrique commented on String Interning: The Garbage Collectible way</title><description>There is a problem in this case, if you intend to have only one string reference for a given string, you will fail.
  
  
if you do something like this, for example:
  
  
lock(String.Intern(product.Id))
  
{
  
}
  
  
The "Clear" method will break this kind of trick.
  
Perhaps, WeakReference would be useful here
</description><link>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment14</link><guid>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment14</guid><pubDate>Wed, 06 Jan 2010 22:00:20 GMT</pubDate></item><item><title>Rafal commented on String Interning: The Garbage Collectible way</title><description>@Leon &amp; others
  
It doesn't make sense to 'scroll' through the buffer of text messages if the buffer contains a gigabyte of data or more. You won't find anything by just scrolling, you need a search engine... So, it means keeping the raw text in memory doesn't make sense, much better to keep just the index in memory and retrieve raw text only when drilling down into details.
  
@Ayende,
  
My colleague has recently built an OLAP cube on IIS log files and uses that cube to analyze the application behavior. It was astonishing how much information he retrieved - he was able to create application performance graphs, analyze activity of users, identify application URLS that have too long execution time or transfer too much data, find errors in integration interfaces, identify several bottlenecks, everything by just slicing &amp; dicing the cube..
  
 Maybe something similar would be useful in your profiler? Statistical analysis is a very effective profiling method especially when you have to analyze large sets of data and today we are talking about amounts like millions of rows of data per day.  We are using the OLAP as a capacity management tool - we process large amounts of information (think months of iis logs) and analyze the patterns and trends that emerge over time so we have a chance to identify performance problems before they are noticed by customers.
</description><link>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment13</link><guid>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment13</guid><pubDate>Sun, 27 Dec 2009 22:26:36 GMT</pubDate></item><item><title>Leon Breedt commented on String Interning: The Garbage Collectible way</title><description>Have you considered a fixed-size buffer of strings, backed by disk storage? e.g. circular buffer of some sort.
  
  
Since I'm assuming your massive collection is append only (e.g. no-one comes and removes a string from the middle).
  
  
Your disk storage would then be indexed by line number, as would entries in your buffer....Someone tries to scroll outside of the starting and finishing bounds of your buffer, and you load in as many strings as appropriate from storage. 
  
  
You'll want to optimize the disk storage for reading obviously, if you're using some form of list virtualization, you would probably want to have a mapping between line number and offset in disk file so you can do a Seek() to starting line and start reading.
  
  
Constrained memory usage, at the expense of a bit of a lag when scrolling far outside the current bounds.
  
</description><link>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment12</link><guid>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment12</guid><pubDate>Sun, 27 Dec 2009 21:43:58 GMT</pubDate></item><item><title>Mike Chaliy commented on String Interning: The Garbage Collectible way</title><description>+1 to Dmitry, for example Sqlite
</description><link>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment11</link><guid>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment11</guid><pubDate>Sun, 27 Dec 2009 21:42:48 GMT</pubDate></item><item><title>Dmitry commented on String Interning: The Garbage Collectible way</title><description>Have you decided to persist strings to a temp storage instead of keeping them in memory?
</description><link>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment10</link><guid>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment10</guid><pubDate>Sun, 27 Dec 2009 18:59:25 GMT</pubDate></item><item><title>Ayende Rahien commented on String Interning: The Garbage Collectible way</title><description>Jon,
  
Because when you do perf testing, you want to make as few changes as you possibly could, fixing one problem at a time.
  
The worst thing you can do is to try to patch over the root problem
</description><link>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment9</link><guid>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment9</guid><pubDate>Sun, 27 Dec 2009 17:10:50 GMT</pubDate></item><item><title>Jon commented on String Interning: The Garbage Collectible way</title><description>Why not leave in the string interning code?  Even if you do only delay the eventual a 50% decrease in memory sounds like a great thing.
</description><link>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment8</link><guid>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment8</guid><pubDate>Sun, 27 Dec 2009 16:46:41 GMT</pubDate></item><item><title>Ayende Rahien commented on String Interning: The Garbage Collectible way</title><description>Ken,
  
Because I there is no way with a HashSet to get the value matching, and I care about the particular reference that I use.
</description><link>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment7</link><guid>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment7</guid><pubDate>Sun, 27 Dec 2009 14:43:40 GMT</pubDate></item><item><title>Ayende Rahien commented on String Interning: The Garbage Collectible way</title><description>Imran,
  
That would keep allocating new strings every time I do the conversion back. I might use less memory in total, but I would allocate a lot more (more GC work)
</description><link>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment6</link><guid>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment6</guid><pubDate>Sun, 27 Dec 2009 14:42:59 GMT</pubDate></item><item><title>Ken Egozi commented on String Interning: The Garbage Collectible way</title><description>why Dict
&lt;string,string&gt;
 and not HashSet
&lt;string?
  
  
I know, I know, delay vs. solve. 
&gt;</description><link>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment5</link><guid>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment5</guid><pubDate>Sun, 27 Dec 2009 13:50:24 GMT</pubDate></item><item><title>Imran commented on String Interning: The Garbage Collectible way</title><description>Another thing you can add to reduce the memory footprint further is utf8 encoding. Store the strings as a byte[] instead by calling Encoding.UTF8.GetBytes(string) to circumvent the default .net utf16 encoding. You can use Encoding.UTF8.GetString to convert back to string as needed. Some characters will still be encoded with 2 bytes but for most ascii strings this will give a memory benefit. As you said before though, it doesn't solve your problem it just delays it.
</description><link>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment4</link><guid>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment4</guid><pubDate>Sun, 27 Dec 2009 11:25:01 GMT</pubDate></item><item><title>Ayende Rahien commented on String Interning: The Garbage Collectible way</title><description>Robert,
  
The short answer is that EnterUpgradeableReadLock would produce a far higher locking rate than read/write.
</description><link>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment3</link><guid>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment3</guid><pubDate>Sun, 27 Dec 2009 11:16:25 GMT</pubDate></item><item><title>Ayende Rahien commented on String Interning: The Garbage Collectible way</title><description>Robert,
  
I'll answer that in a separate post.
</description><link>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment2</link><guid>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment2</guid><pubDate>Sun, 27 Dec 2009 11:05:18 GMT</pubDate></item><item><title>Robert commented on String Interning: The Garbage Collectible way</title><description>Any reason for which you don't use EnterUpgradeableReadLock in Intern method?
</description><link>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment1</link><guid>http://ayende.com/4341/string-interning-the-garbage-collectible-way#comment1</guid><pubDate>Sun, 27 Dec 2009 10:38:17 GMT</pubDate></item></channel></rss>