Re: OT: Programming Languages

Liste des GroupesRevenir à se design 
Sujet : Re: OT: Programming Languages
De : blockedofcourse (at) *nospam* foo.invalid (Don Y)
Groupes : sci.electronics.design
Date : 02. Nov 2024, 21:48:26
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vg6376$3ui18$2@dont-email.me>
References : 1 2 3 4 5 6
User-Agent : Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2
On 11/2/2024 11:01 AM, Martin Brown wrote:
Most compilers these days are smart enough to move loop invariants outside of a loop and then dispose of the loop. You must have side effects in any code that you want to benchmark. Optimisers can be *really* smart about rearranging code for maximum performance by avoiding pipeline stalls. Only the very best humans can match them now.
You need a few more asterisks stressing "really"!  What's most amusing
is how the folks who write "clever"/obscure code fragments THINKING they
are "optimizing" it just annoy the compiler.  On any substantial piece
of code, "you" simply can't outperform it.  Your mind gets tired.  You
make mistakes.  The compiler just plows ahead.  EVERY TIME IT IS INVOKED!

Every now and then you stumble upon a construct that on certain platforms is unreasonably fast (2x or 4x). Increasingly because it has vectorised a loop on the fly when all go faster stripes are enabled.
A developer /aware of the platform on which the code will execute/ can often
design a better *algorithm* to beat the compiler's optimizations of a poorer
algorithm.
I spend a lot of time thinking about how my data is structured to exploit
features present in the hardware.  E.g., a traditional mind would group
all of a task's state into a single struct.  But, that will almost certainly
span a couple of cache lines.
So, when looking at scheduling decisions, the *processor* will be flitting
around between many cache lines -- examining *a* piece of data in each.
So, more trips to memory to fill those other cache lines just to examine
that one datum in each cache line "wasted" on it's fetch.
Instead, group the parameters from MANY tasks in such a way that the
examination of the datum for the first task drags similar data into
that cache line for the *next* task's parameters; leverage the
effort already expended on THAT cache line instead of just (likely)
discarding it in favor of fetching another line.
So, instead of just knowing, e.g., when to use a particular type of
search or sort algorithm (based on a characterization of the data to
be searched/sorted), you think about the "hardware algorithm" that
your code is invoking to support whatever your hardware is doing.
Note how large caches have become on modern processors.  And, the wasted
opportunities they represent for multithreaded implementations ("Gee,
all of that data in the cache that I thought I could make use of is now
largely useless as the next task isn't likely to benefit from it!")
[Another argument affecting the choice of implementation languages;
locality of reference.  Stack computers, anyone??]

Precision timers and benchmarking tools are available on most platforms no need to use a stop watch unless you enjoy watching paint dry.
This is complicated if you have a interrupts that can nickel and
dime your execution time.
Benchmarking, in general, is fraught with perils for the naive.
Few truly understand the scope of their *select* "micro-optimizations".
In the 80's, there was an ongoing split in the Motogorilla vs. Inhell
camps over *system* designs.  Folks would make arbitrary claims
(backed up with REAL data) to support why X was better than Y.
But, they rarely looked at the whole picture.  And, a product *is*
"the whole picture".
    "Yeah, its nice that one opcode fetch allows you to push/pull
    *all* of the processor state (vs. having to fetch an instruction
    to push/pop each individual item).  But, your code is more than
    just push/pull operations.  If you are constantly going back to
    memory to store the (temporary?) result of the last instruction,
    then having internal state that can be used to eliminate that
    memory access allows the *process* to run faster.  'Let's hold
    memory DOLLARS constant and see how well things perform...'"
[Gee, this processor runs at 8MHz while this other runs at 2...
which is MORE PRODUCTIVE?]

Date Sujet#  Auteur
1 Nov 24 * OT: Programming Languages77Cursitor Doom
1 Nov 24 +* Re: OT: Programming Languages3Liz Tuddenham
2 Nov 24 i`* Re: OT: Programming Languages2Don Y
2 Nov 24 i `- Re: OT: Programming Languages1Don Y
1 Nov 24 +- Re: OT: Programming Languages1john larkin
1 Nov 24 +* Re: OT: Programming Languages40Jeroen Belleman
2 Nov 24 i`* Re: OT: Programming Languages39Nick Hayward
2 Nov 24 i +* Re: OT: Programming Languages12Don Y
2 Nov 24 i i`* Re: OT: Programming Languages11john larkin
2 Nov 24 i i +* Re: OT: Programming Languages5Joe Gwinn
2 Nov 24 i i i+* Re: OT: Programming Languages3Don Y
2 Nov 24 i i ii`* Re: OT: Programming Languages2Joe Gwinn
2 Nov 24 i i ii `- Re: OT: Programming Languages1Don Y
2 Nov 24 i i i`- Re: OT: Programming Languages1john larkin
2 Nov 24 i i `* Re: OT: Programming Languages5Martin Brown
2 Nov 24 i i  +- Re: OT: Programming Languages1john larkin
2 Nov 24 i i  `* Re: OT: Programming Languages3Don Y
3 Nov 24 i i   `* Re: OT: Programming Languages2Dennis
3 Nov 24 i i    `- Re: OT: Programming Languages1Don Y
2 Nov 24 i +- Re: OT: Programming Languages1Jeroen Belleman
2 Nov 24 i `* Re: OT: Programming Languages25Jan Panteltje
2 Nov 24 i  +* Re: OT: Programming Languages16Cursitor Doom
3 Nov 24 i  i`* Re: OT: Programming Languages15Bill Sloman
3 Nov 24 i  i `* Re: OT: Programming Languages14Cursitor Doom
3 Nov 24 i  i  +- Re: OT: Programming Languages1Bill Sloman
3 Nov 24 i  i  `* Re: OT: Programming Languages12john larkin
3 Nov 24 i  i   +* Re: OT: Programming Languages10Cursitor Doom
3 Nov 24 i  i   i`* Re: OT: Programming Languages9john larkin
3 Nov 24 i  i   i `* Re: OT: Programming Languages8Cursitor Doom
3 Nov 24 i  i   i  `* Re: OT: Programming Languages7john larkin
4 Nov 24 i  i   i   `* Re: OT: Programming Languages6Bill Sloman
4 Nov 24 i  i   i    `* Re: OT: Programming Languages5Cursitor Doom
4 Nov 24 i  i   i     +- Re: OT: Programming Languages1Bill Sloman
4 Nov 24 i  i   i     `* Re: OT: Programming Languages3john larkin
5 Nov 24 i  i   i      `* Re: OT: Programming Languages2Cursitor Doom
5 Nov 24 i  i   i       `- Re: OT: Programming Languages1Bill Sloman
4 Nov 24 i  i   `- Re: OT: Programming Languages1Bill Sloman
2 Nov 24 i  `* Re: OT: Programming Languages8john larkin
2 Nov 24 i   +* Re: OT: Programming Languages3Edward Rawde
2 Nov 24 i   i`* Re: OT: Programming Languages2john larkin
2 Nov 24 i   i `- Re: OT: Programming Languages1Edward Rawde
2 Nov 24 i   +- Re: OT: Programming Languages1Jan Panteltje
2 Nov 24 i   +- Re: OT: Programming Languages1Jeroen Belleman
2 Nov 24 i   `* Re: OT: Programming Languages2Jeroen Belleman
2 Nov 24 i    `- Re: OT: Programming Languages1Don Y
2 Nov 24 +* Re: Programming Languages16Edward Rawde
2 Nov 24 i`* Re: Programming Languages15Bill Sloman
2 Nov 24 i `* Re: Programming Languages14Edward Rawde
2 Nov 24 i  +* Re: Programming Languages12Cursitor Doom
2 Nov 24 i  i+* Re: Programming Languages6Edward Rawde
2 Nov 24 i  ii`* Re: Programming Languages5Cursitor Doom
2 Nov 24 i  ii +* Re: Programming Languages2Edward Rawde
2 Nov 24 i  ii i`- Re: Programming Languages1Cursitor Doom
3 Nov 24 i  ii `* Re: Programming Languages2Bill Sloman
3 Nov 24 i  ii  `- Re: Programming Languages1Cursitor Doom
3 Nov 24 i  i`* Re: Programming Languages5Bill Sloman
3 Nov 24 i  i `* Re: Programming Languages4Cursitor Doom
3 Nov 24 i  i  `* Re: Programming Languages3Bill Sloman
3 Nov 24 i  i   `* Re: Programming Languages2Cursitor Doom
3 Nov 24 i  i    `- Re: Programming Languages1Bill Sloman
3 Nov 24 i  `- Re: Programming Languages1Bill Sloman
2 Nov 24 +* Re: OT: Programming Languages12Jan Panteltje
2 Nov 24 i+* Re: OT: Programming Languages3Cursitor Doom
2 Nov 24 ii`* Re: OT: Programming Languages2Jan Panteltje
2 Nov 24 ii `- Re: OT: Programming Languages1Cursitor Doom
2 Nov 24 i`* Re: OT: Programming Languages8john larkin
2 Nov 24 i `* Re: OT: Programming Languages7Jan Panteltje
2 Nov 24 i  `* Re: OT: Programming Languages6john larkin
2 Nov 24 i   `* Re: OT: Programming Languages5Cursitor Doom
4 Nov 24 i    +- Re: OT: Programming Languages1Bill Sloman
4 Nov 24 i    `* Re: OT: Programming Languages3john larkin
4 Nov 24 i     `* Re: OT: Programming Languages2Edward Rawde
5 Nov 24 i      `- Re: OT: Programming Languages1Cursitor Doom
2 Nov 24 +* Re: OT: Programming Languages2Ian
2 Nov 24 i`- Re: OT: Programming Languages1Don Y
3 Nov 24 `* Re: OT: Programming Languages2maitre Aliboron
3 Nov 24  `- Re: OT: Programming Languages1Don Y

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal