﻿<?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>Adam Dymitruk commented on The HIGH cost of ConcurrentBag in .NET 4.0</title><description>I thought @kkozmic found out about this a while back and said to stay away from the concurrent classes no?</description><link>http://ayende.com/156097/the-high-cost-of-concurrentbag-in-net-4-0#comment10</link><guid>http://ayende.com/156097/the-high-cost-of-concurrentbag-in-net-4-0#comment10</guid><pubDate>Tue, 26 Jun 2012 07:08:13 GMT</pubDate></item><item><title>Alois Kraus commented on The HIGH cost of ConcurrentBag in .NET 4.0</title><description>ConcurrentBag is another word for memory leak. See http://stackoverflow.com/questions/10850443/concurrentbag-does-cause-memory-leak  It is very difficult to use it right. Besides this it does consume waay more memory for simple data types like an integer. I have in general a problem with a type that keeps a disposable object (ThreadLocal) inside it but it does not implement the IDisposable interface. The only way to get rid of the threadlocals is to terminate the thread which did create the ConcurrentBag. This is still not fixed with .NET 4.5.</description><link>http://ayende.com/156097/the-high-cost-of-concurrentbag-in-net-4-0#comment9</link><guid>http://ayende.com/156097/the-high-cost-of-concurrentbag-in-net-4-0#comment9</guid><pubDate>Tue, 12 Jun 2012 18:34:44 GMT</pubDate></item><item><title>Ayende Rahien commented on The HIGH cost of ConcurrentBag in .NET 4.0</title><description>Chris,
For example, we have state associated with queries in RavenDB, we initially put that state (for each unique query) inside a ConcurrentBag.
But it turns out that just the act of creating the bag can be the most expensive thing there.</description><link>http://ayende.com/156097/the-high-cost-of-concurrentbag-in-net-4-0#comment8</link><guid>http://ayende.com/156097/the-high-cost-of-concurrentbag-in-net-4-0#comment8</guid><pubDate>Fri, 08 Jun 2012 00:47:45 GMT</pubDate></item><item><title>Chris commented on The HIGH cost of ConcurrentBag in .NET 4.0</title><description>You do realize you're testing how many ConcurrentBag objects you can synchronously instantiate, not how many items you can put into a ConcurrentBag, right? What's an example use case for creating n ConcurrentBag objects in a loop? I can imagine adding n items to a ConcurrentBag, but not creating n ConcurrentBags.</description><link>http://ayende.com/156097/the-high-cost-of-concurrentbag-in-net-4-0#comment7</link><guid>http://ayende.com/156097/the-high-cost-of-concurrentbag-in-net-4-0#comment7</guid><pubDate>Fri, 08 Jun 2012 00:43:10 GMT</pubDate></item><item><title>anton commented on The HIGH cost of ConcurrentBag in .NET 4.0</title><description>How is this testing concurrent bag? All I can see is you testing the constructor for concurrent bag by adding it to a list and not actually adding items to the bag or dealing with the bag.  Is that the only issue? When you have 10000 bags created do they perform reasonably?</description><link>http://ayende.com/156097/the-high-cost-of-concurrentbag-in-net-4-0#comment6</link><guid>http://ayende.com/156097/the-high-cost-of-concurrentbag-in-net-4-0#comment6</guid><pubDate>Thu, 07 Jun 2012 20:35:55 GMT</pubDate></item><item><title>Marcos commented on The HIGH cost of ConcurrentBag in .NET 4.0</title><description>The memory perspective is very interesting too, in some concurrent scenarios using a ReaderWriterLockSlim is very costly in memory terms

http://social.msdn.microsoft.com/Forums/da-DK/netfxbcl/thread/fe2ce8aa-dd78-42e6-b5f4-26df96a16bc2

Also the basic Concurrent classes like the ConcurrentDictionary if you create a ton of them (For example we used ConcurrentDictionary for some caching in each entity and profiling a bit we found the memory problem on the ConcurrentDictionary)

Cheers</description><link>http://ayende.com/156097/the-high-cost-of-concurrentbag-in-net-4-0#comment5</link><guid>http://ayende.com/156097/the-high-cost-of-concurrentbag-in-net-4-0#comment5</guid><pubDate>Thu, 07 Jun 2012 13:42:36 GMT</pubDate></item><item><title>Janus007 commented on The HIGH cost of ConcurrentBag in .NET 4.0</title><description>You just stole 2min of my time, why?

Ayende, you can do better than that :)</description><link>http://ayende.com/156097/the-high-cost-of-concurrentbag-in-net-4-0#comment4</link><guid>http://ayende.com/156097/the-high-cost-of-concurrentbag-in-net-4-0#comment4</guid><pubDate>Thu, 07 Jun 2012 12:01:45 GMT</pubDate></item><item><title>tobi commented on The HIGH cost of ConcurrentBag in .NET 4.0</title><description>I'm curious to see what they changed in ThreadLocal. The 4.0 implementation was extremely unusual and interesting.</description><link>http://ayende.com/156097/the-high-cost-of-concurrentbag-in-net-4-0#comment3</link><guid>http://ayende.com/156097/the-high-cost-of-concurrentbag-in-net-4-0#comment3</guid><pubDate>Thu, 07 Jun 2012 11:25:09 GMT</pubDate></item><item><title>Damian commented on The HIGH cost of ConcurrentBag in .NET 4.0</title><description>Bug in your 'per item' timings there...</description><link>http://ayende.com/156097/the-high-cost-of-concurrentbag-in-net-4-0#comment2</link><guid>http://ayende.com/156097/the-high-cost-of-concurrentbag-in-net-4-0#comment2</guid><pubDate>Thu, 07 Jun 2012 09:43:38 GMT</pubDate></item><item><title>Rik Hemsley commented on The HIGH cost of ConcurrentBag in .NET 4.0</title><description>This is why tests should fail if performance is too poor. It's not hard to write such tests for this kind of code, which has no external dependencies.</description><link>http://ayende.com/156097/the-high-cost-of-concurrentbag-in-net-4-0#comment1</link><guid>http://ayende.com/156097/the-high-cost-of-concurrentbag-in-net-4-0#comment1</guid><pubDate>Thu, 07 Jun 2012 09:41:12 GMT</pubDate></item></channel></rss>