Augusta Ada King, Countess of Lovelace (10 December 1815 – 27 November 1852), born Augusta Ada Byron and now commonly known as Ada Lovelace, was an English mathematician and writer chiefly known for her work on Charles Babbage's early mechanical general-purpose computer, the analytical engine. Her notes on the engine include what is recognised as the first algorithm intended to be processed by a machine; thanks to this, she is sometimes considered the world's first computer programmer.
The computer language Ada, created on behalf of the United States Department of Defense, was named after Ada Lovelace.
"Ada Lovelace Day" is an annual event celebrated on October 16th whose goal is to "raise the profile of women in science, technology, engineering and maths". The Ada Initiative is a non-profit organization dedicated to increasing the involvement of women in the free culture and open source movements.
Wikipedia
Ada Lovelace Day: Women celebrate female scientists - BBC
Ada Lovelace Day Celebrates Women in Science - National Geographic
Celebrate Ada Lovelace Day - CNet
Celebrating Women in Technology for Ada Lovelace Day 2012 - EFF
Programming Optimization and Performance
Tips, tricks, techniques for C# optimization and performance
Program optimization@wikipedia - first learn its description :)
C# Optimizations@dotnetperls
Optimization Misnomer@dotnetperls
Hidden Features of C#@stackoverflow
How to Write High-Performance C# Code
Code performance analysis in Visual Studio 2008
Improving .NET Application Performance and Scalability@Microsoft (book, you can download)
Writing High-Performance Managed Applications : A Primer@MSDN
Writing Faster Managed Code: Know What Things Cost@MSDN
Performance Tips and Tricks in .NET Applications@MSDN
Optimize Your Program Performance@wikihow
http://stackoverflow.com/a/927773 - how a performance tuning can be done
http://stackoverflow.com/a/2473829
Performance@MSDN
BONUS
Grace Hopper To Programmers: Mind Your NanoSeconds
"The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet." (Michael A. Jackson)
Program optimization@wikipedia - first learn its description :)
C# Optimizations@dotnetperls
Optimization Misnomer@dotnetperls
Hidden Features of C#@stackoverflow
How to Write High-Performance C# Code
Code performance analysis in Visual Studio 2008
Improving .NET Application Performance and Scalability@Microsoft (book, you can download)
Writing High-Performance Managed Applications : A Primer@MSDN
Writing Faster Managed Code: Know What Things Cost@MSDN
Performance Tips and Tricks in .NET Applications@MSDN
Optimize Your Program Performance@wikihow
http://stackoverflow.com/a/927773 - how a performance tuning can be done
http://stackoverflow.com/a/2473829
Performance@MSDN
You can use some profiling tools.
Grace Hopper To Programmers: Mind Your NanoSeconds
"The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet." (Michael A. Jackson)
StringBuilder vs String Concat
Lets look at StringBuilder class and string '+' operator performances. I wrote a small program that compares execution times and memory usage.
This program concats strings with variety sizes for 1, 10, 100, 1000, 10000, 100000, 1000000 times.
Here are the results
Execution time with string.
After 10 minutes i terminated the program.
Execution time with stringbuilder
Memory Usage - String
Memory Usage - StringBuilder
Stopwatch@MSDN
GC.GetTotalMemory@MSDN
PrivateMemorySize64@MSDN
This program concats strings with variety sizes for 1, 10, 100, 1000, 10000, 100000, 1000000 times.
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Diagnostics;
- namespace Test
- {
- class Program
- {
- static string[] data = {"a", "ab", "abc", "abcd", "abcde",
- static void Main(string[] args)
- {
- StringTest();
- //StringBuilderTest();
- //StringMemoryTest();
- //StringBuilderMemoryTest();
- Console.ReadLine();
- }
- static void StringTest()
- {
- string collector = string.Empty;
- int count = 1;
- Console.WriteLine("Loop Time");
- for (int i = 1; i <= 7; i++) //1, 10, 100, 1000, 10000, 100000, 1000000
- {
- sw.Start();
- for (int j = 0; j < count; j++)
- {
- collector = collector + data[j % 10];
- }
- sw.Stop();
- TimeSpan ts = sw.Elapsed;
- Console.WriteLine("{0,-12:d}{1:0} ms", count, ts.TotalMilliseconds);
- count *= 10;
- collector = string.Empty;
- sw.Reset();
- }
- }
- static void StringBuilderTest()
- {
- int count = 1;
- Console.WriteLine("Loop Time");
- for (int i = 1; i <= 7; i++) //1, 10, 100, 1000, 10000, 100000, 1000000
- {
- sw.Start();
- for (int j = 0; j < count; j++)
- {
- collector.Append(data[j % 10]);
- }
- sw.Stop();
- TimeSpan ts = sw.Elapsed;
- Console.WriteLine("{0,-12:d}{1:0} ms", count, ts.TotalMilliseconds);
- count *= 10;
- sw.Reset();
- }
- }
- static void StringMemoryTest()
- {
- string collector = string.Empty;
- int count = 1;
- long m = 0;
- Console.WriteLine("Loop Memory");
- for (int i = 1; i <= 7; i++) //1, 10, 100, 1000, 10000, 100000, 1000000
- {
- for (int j = 0; j < count; j++)
- {
- collector = collector + data[j % 10];
- }
- //m = GC.GetTotalMemory(false);
- m = Process.GetCurrentProcess().PrivateMemorySize64;
- Console.WriteLine("{0,-12:d}{1:0} kb", count, m / 1024);
- count *= 10;
- collector = string.Empty;
- }
- }
- static void StringBuilderMemoryTest()
- {
- int count = 1;
- long m = 0;
- Console.WriteLine("Loop Memory");
- for (int i = 1; i <= 7; i++) //1, 10, 100, 1000, 10000, 100000, 1000000
- {
- for (int j = 0; j < count; j++)
- {
- collector.Append(data[j % 10]);
- }
- //m = GC.GetTotalMemory(false);
- m = Process.GetCurrentProcess().PrivateMemorySize64;
- Console.WriteLine("{0,-12:d}{1:0} kb", count, m / 1024);
- count *= 10;
- }
- }
- }
- }
Here are the results
Execution time with string.
After 10 minutes i terminated the program.
Execution time with stringbuilder
Memory Usage - String
Memory Usage - StringBuilder
Stopwatch@MSDN
GC.GetTotalMemory@MSDN
PrivateMemorySize64@MSDN
Subscribe to:
Posts (Atom)