Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Your crystal ball?
Message
De
10/10/2020 17:21:46
 
 
À
01/10/2020 17:03:53
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01676408
Message ID:
01676591
Vues:
97
J'aime (1)
>Thank you Bill.
>
>>>How important is C# nowadays?
>>>
>>Very important.
>>However, once you've learned it, there are many ways to use it.
>>.NET Framework, .NET Core, etc, etc.
>>
>>.NET Core is exciting because it runs on Windows and Linux, et al - taking away a negative that limited ASP.Net which only ran on Windows.

All this discussion made me curious.

So I wrote two for loops that execute a billion times each.

Here's my machine:
Windows 10
Processor Intel(R) Core(TM) i5-4670 CPU @ 3.40GHz, 3401 Mhz, 4 Core(s), 4 Logical Processor(s)
16GB RAM

VFP
CLOSE ALL
CLEAR ALL

m.starttime = SECONDS()
FOR  m.x  = 1 TO 1000000000
ENDFOR
m.endtime = SECONDS()
WAIT WINDOW "Elapased time = " + TRANSFORM ( m.endtime - m.starttime , "999.999") + " seconds" 
Time: 14.9 seconds

.NET
using System;
using System.Windows.Forms;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace forloop
{
    class Program
    {
        static void Main(string[] args)
        {
            Stopwatch stopWatch = new Stopwatch();
            stopWatch.Start();
            for (int i =  1; i < 1000000000; i ++ )
            {

            }
            TimeSpan span = stopWatch.Elapsed;
            double seconds = span.Seconds;
             MessageBox.Show("Elapsed time - seconds : " + seconds.ToString("##0.000"));
        }
    }
}
Time: 2 seconds

I've never done anything like this before, so the comparison might not be valid.
But it looks as if the .NET code is a lot faster for an almost identical problem.
Anyone who does not go overboard- deserves to.
Malcolm Forbes, Sr.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform