| Sam Allen's profileDOT NET PERLSBlogListsSkyDrive | Help |
|
|
Micro-benchmark: Linq on Windows Controls MOVEDPlease see the Dot Net Perls Dot Com article on Micro-Benchmarking Linq!Excel Interop Performance--MOVEDI have edited this content and converted it into two articles. They have been improved, and put on a much nicer site (no ads). Improve Performance with NGEN: MovedI'm sorry, this content has been moved. Google will figure out eventually. Look for the new Installer class here. It works as well as ever, and it is free! It is available at Google Code from a link on the new site. My Take on Integer Parsing MOVEDThis post has been moved to a new home at Dot Net Perls Dot Com!Alphanum/Alphanumeric Sorting MOVEDNew Article Here--I have improved this post quite a lot and put it in a much better format at the link provided. Code is also available at the new site Optimizing SQLite/rowid: MOVEDThis page is now located at Dot Net Perls Dot Com. It discusses SQLite rowid joins, etc. Memory Allocation/Software BreakthroughIn software development, the most exiting (exhilarating) moments are when a change you just made not only works properly, but causes a massive improvement in the speed or quality of your product. I cherish those moments when, after literally staying awake for 10 hours all night, a complicated and difficult change finally compiles, and works properly. One change I made saved megabytes of RAM by using a special tree structure; it was a thrill after staying awake all night. When a novice developer first makes a database without an index, it will be very slow. But just by making his/her first index, the database will become a hundred times faster. These are decisive improvements that are indisputable. There aren't any benchmarks showing 1%, 1.5% improvements, but common sense and examination in passing can validate the improvement. These are the changes that make software design fun. Fixing bug #25 (or 1,000) is fine and important, and may well be critical to the health of the project, but this kind of change is more exciting. In the Mozilla project, the last change I thought was truly a big enhancement was the special back/forward cache. Basically, with that cache, the browser would store a previously-viewed page in its finished state and simply display it again when the user clicks back (or forward). Thus, the time for rendering a 10 MB HTML file could drop from 10 (30?) seconds, to .1 seconds. Recently, a change in the memory allocator in Firefox/Mozilla was made. A new allocator made by Jason Evans (and used mainly in various forms of BSD) was used to replace the system allocator on Windows. Now, the system Malloc() on Windows is fine a lot of the time, but even in .NET and Microsoft's own projects, it is not used. It is old and I don't think it is being improved by Microsoft. Dot Net uses a custom garbage collector. Over the last 10 years, Mozilla has had this behavior: start at 10-20 MB of RAM used, and gradually grow. There was no reduction of RAM really. So, after a day, I would see 100 MB. I restart/shutdown usually, but occasionally I would see 150 MB. I don't think it would stop, ever. JEMalloc has fixed this behavior for me. It changes the allocation patterns entirely. I see the browser get up to 60 MB, 70 MB, and it will stay there. If I open a bunch of stuff, the browser will get to 150 MB, but then when I close those documents, it will go to 60 MB again. The final effect is simple and that is that it fixes the endless growth of memory usage. I use other programs, as do most people, to actually be productive with my computer. Those programs use 100+ MB, 200+ MB, but they have more of a rationale for that. So, JEMalloc fixes the problem for me. Maybe it doesn't work indefinitely, but it is far better than before. It fixes probably the most hated Mozilla bug (on Windows?) of the last 10 years. Precomputed Bitcounts: MOVEDThis article is now located at Dot Net Perls Dot Com! Look Here! Enjoy! There's lots of code too. Scrabble in Perl: Moved (Code at new site)UPDATE: See below. Open source code is now available!
Look at http://dotnetperls.com/Content/Scrabble-Algorithm-Perl.aspx for the post and a link to my Google Code site for the source. C# Code MovedAll this code can now be found at Dotnetperls.com Single Instance Code; Using BeginInvoke on a Thread with a Timer; Open-Source CodeHere's some more open-source code I have developed or adapted. The first class enabled single-instance applications that actually works (most Mutex approaches on the 'Net will fail a lot). The process code is adapted from the work of a Microsoft engineer posted on a mailing list. The second file is a speciality class I use to make UI updates really polished and even. It works great. I will post more code in the coming days/weeks. Have fun.
Here's how to use ProcessChecker to create a single instance app: // the string "Launcher" must be contained in the window you will want to focus if it is running. if (ProcessChecker.IsOnlyProcess("Launcher"))
{
}
Here's how to use RenderScheduler.cs to make the screen updates of your app fluid and even:
// declare this in your class
delegate void UpdateGridDelegate(object ob);
// instantiate the object in your constructor for the form
_threader = new RenderScheduler(Properties.Settings.Default.UpdateThrottle,
new UpdateGridDelegate(BuildDataGrid), this);
// call this whenever you want to launch the threaded function (not on UI thread)
ThreadPool.QueueUserWorkItem(new WaitCallback(BuildDataGridThreader));
// use this function to do the processing
// the delegate UpdateGridDelegate will be used to call BuildDataGrid
// when the appropriate functions of _threader are called in this function.
void BuildDataGridThreader(object ob)
{
}
Hope that helps. Remember to have fun. NOTE: The source code is in my public folder and is linked to in later posts. |
|
|