Click here to Skip to main content
15,892,737 members
Articles / Desktop Programming / WPF

Benchmark start-up and system performance for .Net, Mono, Java, C++ and their respective UI

Rate me:
Please Sign up or sign in to vote.
4.94/5 (44 votes)
2 Sep 2010CPOL19 min read 160.7K   1.3K   67  
What is the start-up and system performance overhead for .Net, Mono, Java versus C++ and Forms, WPF, Swing versus MFC
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace DotNet40UIPerf
{
    public partial class Form1 : Form
    {
        private const long TicksPerMiliSecond = TimeSpan.TicksPerSecond / 1000;
        int _result = 0;
        public Form1()
        {
            InitializeComponent();
        }

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static int Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Form1 f = new Form1();
            Application.Run(f);
            return f._result;
        }

        protected override void OnActivated(EventArgs e)
        {
            base.OnActivated(e);
            if (Environment.GetCommandLineArgs().Length == 1)
            {
                System.GC.Collect(2, GCCollectionMode.Forced);
                System.GC.WaitForPendingFinalizers();
            }
            else if (this.WindowState == FormWindowState.Normal)
            {
                DateTime mainEntryTime = DateTime.UtcNow;

                string launchtime = Environment.GetCommandLineArgs()[1];
                DateTime launchTime = System.DateTime.FromFileTimeUtc(long.Parse(launchtime));
                long diff = (mainEntryTime.Ticks - launchTime.Ticks) / TicksPerMiliSecond;
                //				string txt = label1.Text ;
                //
                //				txt += " Activated";
                //				label1.Text = txt;	
                _result = (int)diff;

            }
            
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
Decebal Mihailescu is a software engineer with interest in .Net, C# and C++.

Comments and Discussions