Hi, On Mon, Mar 20, 2023 at 5:20 PM Rugxulo <rugx...@gmail.com> wrote: > > On Mon, Mar 20, 2023 at 5:06 PM Bret Johnson <bretj...@juno.com> wrote: > > > > This is something much more serious than a "tradeoff" or a > > "regression". My new i5 CPU appears to be spending _at least_ 99% > > of its resources NOT processing OpCodes and NOT accessing the > > cache (because there isn't one). And the problem is blamed on > > "sub-optimal code". I don't know what the CPU is doing with all > > those resources it has, but I do know what it's NOT doing. I do know > > that what's going on inside a CPU is very complicated. Call me naive, > > but I always thought the primary purpose of a CPU was to process > > OpCodes. Silly me. > > > > >> I think it probably > > >> would be -- I certainly think it would be WAY faster than my 3.3 GHz > > >> i5. > > > > > nope. > > > > Even though a 350 MHz K6-2 is WAY faster than my 3.3 GHz i5? > > And again, I know it doesn't make any sense, but it's still true. > > Self-modifying code??
Seriously, older machines were faster with self-modifying code, but newer ones are much more sensitive and slower. Anything within a (roughly) 4 kb radius gets slowed down dramatically. I noticed this, years ago, on my old AMD TK53x2 laptop. * https://en.wikipedia.org/wiki/Self-modifying_code#Interaction_of_cache_and_self-modifying_code "In some cases short sections of self-modifying code execute more slowly on modern processors. This is because a modern processor will usually try to keep blocks of code in its cache memory. Each time the program rewrites a part of itself, the rewritten part must be loaded into the cache again, which results in a slight delay, if the modified codelet shares the same cache line with the modifying code, as is the case when the modified memory address is located within a few bytes to the one of the modifying code." "PC processors must handle self-modifying code correctly for backwards compatibility reasons but they are far from efficient at doing so." Maybe speculative execution is affected by this, too? * https://en.wikipedia.org/wiki/Speculative_execution _______________________________________________ Freedos-devel mailing list Freedos-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-devel