Click here to Skip to main content
15,881,898 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Billions of transistors right next to me Pin
W Balboos, GHB1-Mar-21 4:11
W Balboos, GHB1-Mar-21 4:11 
GeneralNeutralino Pin
#realJSOP28-Feb-21 2:18
mve#realJSOP28-Feb-21 2:18 
GeneralRe: Neutralino Pin
OriginalGriff28-Feb-21 2:27
mveOriginalGriff28-Feb-21 2:27 
JokeRe: Neutralino Pin
Daniel Pfeffer28-Feb-21 3:13
professionalDaniel Pfeffer28-Feb-21 3:13 
GeneralRe: Neutralino Pin
Greg Utas28-Feb-21 2:51
professionalGreg Utas28-Feb-21 2:51 
GeneralRe: Neutralino Pin
#realJSOP28-Feb-21 3:24
mve#realJSOP28-Feb-21 3:24 
GeneralRe: Neutralino Pin
pkfox28-Feb-21 5:00
professionalpkfox28-Feb-21 5:00 
GeneralRe: Neutralino Pin
Espen Harlinn28-Feb-21 6:50
professionalEspen Harlinn28-Feb-21 6:50 
Quote:
I still try to code as if both of those things were still in play.

I believe they are more important than ever.

Strangely enough some (many?, most?) cannot get the correlation between poorly performing software and the cost of deploying said software to the cloud.

In my guesstimate 99% of the software that gets pushed at unsuspecting customers, consume more than 100 x (not %) the resources it should have done in an even remotely sane world.

Here is a silly python snippet, its only purpose is to burn CPU time:
from datetime import datetime

def AddUp(x):
    if x > 0:
        return AddUp(x - 1) + x
    else:
        return 0

def CallAddUp():
    result = 0
    for x in range(1000000):
        result = result + AddUp(512)
    return result

started = datetime.now()
result = CallAddUp()
finished = datetime.now()
duration = finished - started

seconds = duration.seconds + duration.microseconds/1E6

print("CallAddUp() returned ", result, " in ", seconds, " seconds")

Run the above, and you get:
CallAddUp() returned  131328000000  in  77.055948  seconds

Doing the same thing in C#
C#
using System;
using System.Diagnostics;

namespace ScriptExample001a
{
    class Program
    {
        static long AddUp(long x)
        {
            if (x > 0)
            {
                return x + AddUp(x - 1);
            }
            else
            {
                return 0;
            }
        }

        static long CallAddUp()
        {
            long result = 0;
            for (long i = 0; i < 1000000; ++i)
            {
                result += AddUp(1000);
            }
            return result;
        }

        static void Main(string[] args)
        {
            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();
            var resultValue = CallAddUp();
            stopwatch.Stop();
            var duration = stopwatch.Elapsed.TotalSeconds;

            Console.Out.WriteLine("C# CallAddUp( ) returned {0} in {1} seconds", resultValue, duration);
        }
    }
}
Run the above, and you get
C# CallAddUp( ) returned 131328000000 in 1,2486408 seconds

And then in C++:
C++
uint64_t AddUp( uint64_t x )
{
    if ( x > 0 )
    {
        return AddUp( x - 1 ) + x;
    }
    else
    {
        return 0;
    }
}

uint64_t CallAddUp( )
{
    uint64_t result = 0;
    for ( size_t i = 0; i < 1000000; ++i )
    {
        result += AddUp( 512 );
    }
    return result;
}
int main()
{
    start = std::clock( );
    resultValue = CallAddUp( );
    duration = ( std::clock( ) - start ) / (double)CLOCKS_PER_SEC;
    printf( "C++ CallAddUp( ) returned %llu in %f seconds\n", resultValue, duration );
}
Run the above, and you get:
C++ CallAddUp( ) returned 131328000000 in 0.000000 seconds

Hence, many (most?) computer scientist have embraced python as their language of choice for crunching numbers …

Never mind that they often store data in text files, and then push them around between a plethora of web-services, …, etc.
Espen Harlinn
Senior Architect - Ulriken Consulting AS

The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility, and among other things he avoids clever tricks like the plague.Edsger W.Dijkstra

GeneralRe: Neutralino Pin
Nelek28-Feb-21 9:48
protectorNelek28-Feb-21 9:48 
GeneralRe: Neutralino Pin
Espen Harlinn28-Feb-21 10:45
professionalEspen Harlinn28-Feb-21 10:45 
GeneralRe: Neutralino Pin
trønderen28-Feb-21 15:29
trønderen28-Feb-21 15:29 
GeneralRe: Neutralino Pin
Espen Harlinn28-Feb-21 17:30
professionalEspen Harlinn28-Feb-21 17:30 
GeneralRe: Neutralino Pin
Daniel Pfeffer28-Feb-21 19:15
professionalDaniel Pfeffer28-Feb-21 19:15 
GeneralRe: Neutralino Pin
trønderen28-Feb-21 22:00
trønderen28-Feb-21 22:00 
GeneralRe: Neutralino Pin
Nelek28-Feb-21 23:03
protectorNelek28-Feb-21 23:03 
GeneralRe: Neutralino Pin
Jon McKee28-Feb-21 12:11
professionalJon McKee28-Feb-21 12:11 
GeneralRe: Neutralino Pin
Espen Harlinn28-Feb-21 12:53
professionalEspen Harlinn28-Feb-21 12:53 
GeneralRe: Neutralino Pin
Jon McKee28-Feb-21 20:23
professionalJon McKee28-Feb-21 20:23 
GeneralRe: Neutralino Pin
Espen Harlinn28-Feb-21 21:07
professionalEspen Harlinn28-Feb-21 21:07 
GeneralRe: Neutralino Pin
Jon McKee28-Feb-21 22:06
professionalJon McKee28-Feb-21 22:06 
GeneralRe: Neutralino Pin
Marc Clifton28-Feb-21 9:49
mvaMarc Clifton28-Feb-21 9:49 
GeneralRe: Neutralino Pin
#realJSOP28-Feb-21 11:02
mve#realJSOP28-Feb-21 11:02 
GeneralElectron? Pin
#realJSOP28-Feb-21 1:45
mve#realJSOP28-Feb-21 1:45 
JokeRe: Electron? Pin
Nelek28-Feb-21 1:51
protectorNelek28-Feb-21 1:51 
GeneralRe: Electron? Pin
Slacker00728-Feb-21 1:56
professionalSlacker00728-Feb-21 1:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.