Showing posts with label old computer. Show all posts
Showing posts with label old computer. Show all posts

Monday, September 15, 2025

Debates about “faster” languages are just plain silly. It’s the optimization of compiler that makes the BIG difference.

 


Question

Why is C++ used at all now that a faster language (Go) has been created?

Just wanted to throw in two cents about binaries from GO supposedly being faster than C++. Recently C++ compiler made my jaw fall to the floor. At my job I have heard a riddle whether modern c++ compilers would be able to convert this recursive function into a loop, at sufficient optimization level. (AFAIK most programming languages would not do that)

int sum(int n) { 

return n ? sum(n-1) + n: 0; 

Generally the answer is yes, gcc or icc would make loop of it and, with extra optimization, unroll it a couple of times. But then one tried clang 5.0, and it produced an arithmetic series summation formula, making this function O(1)!

One could argue that this is just a cheap trick… the thing is there could be thousands of such “cheap tricks” in C++ compilers… And you need long years of well planned development to put such “cheap tricks” in production.

Answer

I “grew up” with optimizing compilers. At one point, Carnegie Mellon University, Computer Science, had one of the most advanced optimizing compilers of its day (1970s). But I’ve read the code from GNU and Microsoft C++, and today’s compilers make our efforts look like a good amateur attempt at optimization. Current compilers can compile 50,000 lines per minute (at least!) and produce code that has inline expansion of functions, cross-procedural optimizations, and mind-boggling optimization techniques. I once read code in which function A called function B, but instead of passing parameters to it, the Microsoft C++ compiler determined that some of the inputs were constants or pass-by-values that were not changed, and instead of pushing parameters onto the stack and calling function B, function A preloaded some registers with values and BRANCHED INTO THE MIDDLE of function B’s code. And the registers were precisely correct, and it avoided doing a hundred or more instructions that would have not been necessary at all if the inputs were known to be read-only. I would fire someone who did that in assembly code, but the compiler gets away with it because it accounts for every source change before determining the validity of the optimization. I’ve seen the Microsoft C++ compiler collapse multiply-instantiated templates into a single code body. I’ve seen output from GNU gcc that makes my head hurt trying to understand it, but which is perfectly correct.

I have no idea what a “faster” language is compared to C++, but I would want to see nontrivial metrics (forget Towers of Hanoi, Sieve of Eratosthenes, and similar toy programs. Compare code size and performance of systems 100K SLOC Source Lines of Code or better). I suspect that Microsoft C++ and gcc can run circles around GO. And take a look at Java HotSpot dynamic compilation and optimization before comparing Java to C++ or any other language. We used to see the same silly comparisons for language complexity, because you could implement “Hello, world” in BASIC in only one line, but every other language took lots of lines and correct punctuation. But you couldn’t maintain 100K SLOC written in BASIC (and I mean the original BASIC, not languages like Visual BASIC, which are modern languages with a few pieces of syntax borrowed from the original Darmouth BASIC).

A good optimizing compiler can take you through a dozen levels of abstraction and generate half an instruction. I don’t trust anyone who says “Language X is faster than Language Y” unless they give details of the metrics they used. Anyone can write a compiler that makes trivial code examples run quickly. Professional compilers can make 100K SLOC be smaller or faster,, independent of the source language.

Each time we added an optimization to the compiler, we knew that it might improve the code by 1%-3%. But put a couple hundred such optimizations in, and “compound interest” wins big. Some years ago, IBM was dismayed that under SPECMark array benchmarks, their compiler ran at 45 SPECMarks and Sun’s ran at 61 (bigger is better). So they wrote a program that took a configuration of the cache behavior of different models of their RISC6000, and wrote a FORTRAN program that took, as input, a FORTRAN program, and produced, as output, another FORTRAN program which did the exact same computation, but segmented the data to maximize cache hits. They ran the array example through this and got a score of…wait for it…900! Many modern FORTRAN compilers now incorporate these transformations internally (this experiment was done in the early 1990s).

Debates about “faster” languages are just plain silly. It’s the compiler that makes the difference.

Friday, June 16, 2017

all USB connectors and USB-C thunderbolt 3 USB 3.1 gen2; speed.






Examples

MacBookPro 2016 2017 

Two or four Thunderbolt 3 (USB‑C) ports
with support for:
  • Charging
  • DisplayPort
  • Thunderbolt (up to 40 Gbps). Thunderbolt is a protocol.
  • USB 3.1 Gen 2, up to 10 Gbps (10 Gbit/s, it's exactly the max of USB 3.1 Gen 2). USB is a protocol.
USB-C is an electronic connectors not a protocol.

Sandisk 32/64Gb

https://www.amazon.fr/Type-C-Connectique-Sandisk-Derni%C3%A8re-Version/product-reviews/B01EZ0X3L8/ref=dpx_acr_txt?showViewpoints=1

Speed


Monday, June 11, 2012

old mac G4, tiger (10.4.11) ou leopard (10.5.8), changer la mémoire PC100 PC133?

Mac OSX 10.5 (10.5.0 en oct 2007 dernière 10.5.8 en aout 2009) a de nombreuses avancées:
http://fr.wikipedia.org/wiki/Mac_OS_X_v10.5
http://en.wikipedia.org/wiki/Mac_OS_X_Leopard
par exemple time machine ou la version d'Xcode 3.0...

Hélas, pour les machines G4 en dessous de 0.867GHz (en fait avec un bus AGP (carte graphique) en dessous de x4), Apple ne soutient officiellement que la 10.4.11.

Des vielles machines qui fêtent leur 10ans (date des G4 en 2002) peuvent profiter d'un système et des services d'aout 2009?
OUI!
Il y a leopard assist:
http://sourceforge.net/projects/leopardassist/


Rester en 10.4.11 si vous avez juste besoin d'un terminal internet, choisissez le navigateur camino 2.1.2 et OSX 10.4.11. C'est rapide et stable:

www.caminobrowser.org
http://fr.wikipedia.org/wiki/Camino
Camino est écrit à l'aide de Cocoa, l'interface de programmation distribuée par Apple, mais utilise le moteur de rendu Gecko des logiciels Mozilla. Depuis la version 2.0, il est nécessaire de disposer de Mac OS 10.4. Début 2011,  Mozilla a annoncé la fin du support de l'intégration de Gecko dans d'autres applications.


----------some comments
-Tiger is old and the G4 is an antique too, it's also one of the best OS's Apple ever made and IMO more stable then Leopard. Also, you'll have to hack Leopard to run on a G4 700 (it's 867 Mhz minimum technically) and the hardware isn't really up to it so it'll chug, a lot.

-I didn't have any real problems with Leopard, apart from the speed decrease. 

-Just thought I'd let you guys know I settled on Leopard. Couple of reasons for this.
1) Despite the fact that I've got a brand new Caviar Blue installed, I like the idea of Time Machine keeping my butt safe because school work will be done on this machine.
2) For whatever reason, the newer Apple apps like Safari 4 and iTunes 9 feel more responsive under Leopard. Performance otherwise seems to be about the same. Leopard took longer to update thanks to the massive size of the 10.5.8 update and the installer took twice as long as the Tiger one, but now that everything is installed and up and running, things are going nicely.
Performance got a nice boost especially while multitasking, but I'm still sadly at a loss for a smooth framerate on YouTube. If I downgrade Flash to v8, I get almost-perfect playback, but not many sites allow 8 anymore. V9 and V10 are terribly slow, and the AGP2X can't hack HTML5 encoded MPEG video.
Reference: http://forums.macrumors.com/showthread.php?t=928676

 C'est un problème proche de celui de passer de XP à Vista en pire pour les windowxiens. Le système 10.5 est un très bon système contrairement à Vista (voir mon post d'hier). Le choix est d'accepter de perdre un peu de réactivité pour gagner de nombreux services et rester dans la course en 2012 pour de nombreux soft.
Si on accepte cela alors il faut bidouiller avec leopardAssist 2.3.3
http://mac.softpedia.com/progChangelog/LeopardAssist-Changelog-28697.html

En outre OSX 10.5 requiert au minimum 512 Mo de RAM pour 9 Go d'espace disque.

Les disques étaient >40Go avec une connectique Firewire 400 mais hélas les USB sont en 1.1 donc très lents. Grace au firewire, on peut travailler en 2012 avec ces antiquités. Les choix d'Apple se révèlent donc toujours intéressants et prolongent la vie des machines vers 12ans.
Préférer prendre un disque dur firewire et USB pour les échanges physiques ou via ethernet.


--------http://forums.macrumors.com/showthread.php?t=1129112
I not only run but regularly use leopard on my 450 mhz Cube in 512 MB. As long as you don't ask too much of it it works fine.
A few comments on softwares:

Safari - Perfectly useable, can be a little slow at times. Flash is of course very slow so make sure you use clicktoflash.

Mail.app - works fine, again a little sluggish at times but perfectly useable.

iTunes - works, though playback eats >20% processor

Photoshop elements 6 - surprisingly useable.

iWork pages - runs OK though I haven't tried large or complex documents which would probably bog it down quite a bit.

MS Word 2004 - probably runs better since it's native PPC code.

Tried Final Cut Express -- installer just laughed at it.

--------------------------

iMac (à écran plat) intègre les deux connecteurs mémoire suivants :
un connecteur SO-DIMM 144 broches "en libre accès"
un connecteur interne DIMM 168 broches (équipé en usine).
Le connecteur en libre accès requiert de la mémoire vive de type PC133. L'utilisation de modules PC100, proscrite sur iMac (à écran plat), peut être à l'origine de problèmes de performances et de fiabilité.


http://support.apple.com/kb/HT3022?viewlocale=fr_FR&locale=fr_FR
donc que 1Go au max


Il faut changer la mémoire pour passer à >512Mo sur un imac.
2 slots:
1 sur carte mère
1 en accès direct mais au format SO-DIMM.

de la PC 100 c'est OK sur les 700-800MHz:
http://www.configmac.com/choisir-memoire-ram.php


Les G4 en-dessous du 1GHz utilisaient de la PC100 pu PC133 SDRAM  (sous 2 formes physiques, par exemple les imac G4 avaient une extension possible sous SO-DIMM comme les portables). On en trouve pas cher.
imac G4: 1GB RAM total so you need two 512MB modules, one DIMM, one SO-DIMM (laptop memory module).

Sur ce 800Mhz, on peut mettre 2 fois 512 Mo , mais pas plus, en effet, en PC 133, car la machine n'accepte pas plus de 1Go en tout.


http://forums.macgeneration.com/mac-ppc-g3-g4-g5/tuto-changement-ram-imac-flat-panel-278099.html
http://forum.macbidouille.com/index.php?showtopic=132436&st=0&p=1262989&#entry1262989


Dimm0/J12 est l'emplacement accessible avec de la SoDimm,
Dimm1/J13 est l'emplacement interne avec de la Dimm (barette plus longue et moins haute que celle accessible). 


Voici un article sur Macbidouille pour changer le DD et le DVD, cela peut aider aussi pour ajouter de la mémoire :
http://www.macbidouille.com/article.php?id...&hi=+imac%20+g4
Et en allant à l'adresse ci-dessous, tu trouveras un manuel de service Apple
http://www.whoopis.com/computer_repair/iMac_flatpanel.pdf



-----------------------------------------------


pour le faire, voir les photo:
http://www.r3uk.com/index.php/tech-tips/34-disassembly-guides/41-apple-imac-original-flat-panel-model-disassembly






et en video:
http://www.youtube.com/watch?v=S72X9Gjy5WM


http://www.applerepairmanuals.com/
rien sur:
http://www.sterpin.net/