déjà t'as oublié de paramètrer la liste avec le type int, ca risque pas de compiler ;)
bon ben en tout cas j'ai pas d'exception comme en Java mais c'est affreusement lent comparé à C#
(à vrai dire j'ai lancé le test avant d'écrire le début de ce post et c'est toujours pas fini d'exécuté ;) )
(j'ai mis le fichier test.cpp dans le même dossier que les .cs et .java)
Je cherches à démontrer que ce que fait le compilo Java est affreux question perfs et que même si c'est lié à l'autoboxing c'est bien un problème lié aux generics, suffit de comparer avec le code C# qui lui n'a pas le même problème et qui pourtant gère aussi l'autoboxing.
Les generics en Java c'est du sucre syntaxique, il n'y a aucun gain de performance liés justement au fait qu'une classe peut être paramètrée par un type primitif, alors que l'implémentation C# démontre clairement que c'est possible et qu'il y a un gain qui est loin d'être négligeable (pour la même raison qu'il existe les types primitifs justement).
Les generics, en plus d'assurer un typage fort, permettent (en C#, pas en Java) de limiter l'autoboxing dans bien des cas.
Ce ne sont pas des entiers de type int (type primitif) mais des instances de Integer qui sont alloués dans cet exemple.
Merci pour l'explication mais j'avais deviné, c'est d'ailleur cela que je voulais mettre en évidence par rapport à C# qui ne fait pas la même bêtise.
D'ailleurs, le code est discutable, ça ressemble plus à une démo.
Bah oui j'ai codé ca en 2 minutes à l'arrache.
pourquoi utiliser une List alors que l'on aurait put utliser un tableau de int puisque l'on connait la taille ?
Pour mettre en évidence un problème évident de conception dans les generics de Java. Met un random si ca t'amuse.
Eh oh, je voulais faire une liste d'entier, pas de ma faute si cette andouille de compilo Sun veut pas que je fasse une arrayList de int !
Enfin si ca t'amuse remplace le List par List dans le .cs, t'auras la même chose qu'en Java et ca ne changera strictement rien, il est pas débile non plus le compilo ;)
http://pascalfresnay.free.fr/divers/generics/(...)
j'ai testé sous zindows (désolé chui pas chez moa), avec J2SE 1.5.03, framework .NET 2.0 beta 2 et mono 1.1.7
En fait j'ai un joli "OutOfMemory : Java Heap space", quelle idée aussi d'allouer des entiers sur le tas franchement ;)
Juste pour le fun, fabrique une arraylist, mets y une bonne floppée d'entier dedans, puis parcours ta liste pour tous les additionner et afficher le résultat. Recommence en C++ ou C# 2. Compare la vitesse.
Forcer de reconnaître qu'il y a tout de même de très mauvais choix de conception en Java ;)
idem sous fedora, y'a un point d'exclamation qui clignotte quand des mises à jour sont dispos (uniquement à travers up2date, ce qui limite l'intérêt)).
QT/KDE utilisent le C++ avec succès.
Si tu trouves que changer le langage et forcer le programmeur à utiliser un pré-compilo c'est utiliser le C++ avec succès évidemment...
Sinon une partie de la réponse à ta question sur le pourquoi de Mono : http://pascalfresnay.free.fr/monoweb/ar01s06s02.html#id2524145(...)
Ben y'a aussi de nettes dégradation :
plus de droits de veto sauf sur l'environnement et le social. En gros il va être très difficile de faire évoluer ces 2 domaines, alors que les autres, en particulier le domaine économique est soumis à la majorité. Chaque ses préférences mais perso j'aurai préférer inverser les domaines et compétences. Rien que pour ca je trouves que c'est une dégradation.
De plus comme je le signalais même si le fonctionnement n'était pas démocratique (l'exécutif qui fait tout), il y avait au moins le droit de veto, et donc il fallait une certaine forme de consensus, si les 25 sont d'accord il y avait tout de même de fortes chances que l'idée ne soit pas trop stupide. Là on applique le principe de majorité à l'exécutif, c'est la porte ouverte à toute forme de décisions et de lois. Là encore je trouve que c'est une nette regression, pour ma part ca sera donc non.
M. Aujourd'hui, le support ce n'est plus la k7 mais le lecteur portable : si on lui colle un système de gestion des droits incontournable par le commun des mortels, terminée la copie comme au bon vieux temps, il y a à mon avis du "nouveau sous le soleil".
Il y aura toujours la prise analogique MIC sur la carte son, et donc la possibilité d'avoir un contenu sans DRM (à moins qu'ils ne veulent même pas qu'on écoute la chatte du voisin miauler à 4h du mat' dans le métro)... Donc non, il n'y aura rien de neuf sous le soleil. Les gens ne passeront plus par eMule et comme au bon vieux temps se refileront les CD en main propre ou se les échangeront sur des réseaux privés (cercle d'ami virtuel).
Enfin tout ca pour dire qu'il ne faut absolument pas se laisser faire en s'imaginait "naïvement" que le seul perdant dans l'histoire sera l'industrie que sciera la branche sur laquelle elle est assise : on veut nous supprimer un droit important, ne l'oublions pas.
Bon alors si on résume, la console c'est ouachement mieux que le PC sauf pour :
- les FPS
- les simulations de vol
- les MMPORG
- les RTS
euh, il reste quoi ? Ah oui les jeux de bagnole et les karaokés. Y'a rien à dire le PC pour jouer, c'est vraiment mort. D'ailleur on se demande ce que font tous ses ados (entre 10 et 30 ans) tous les we avec leur pc dans des salles des fêtes...
Je me suis renseigné, et il y a procédure de co-décision, et ce n'est absolument pas le parlement qui a le dernier mot, mais bien le conseil.
Il suffit de voir l'affaire des brevets qu'il est bien plus facile d'approcher les parlementaires que les membres du conseil.
Bah oui c'est tout le problème : on nous refile entre les doigts une démocratie parlementaire mais en réalité c'est pas elle qui a les pouvoirs mais l'exécutif au-dessus, avec un tampon au milieu : la comission.
Avec le TCE ca s'améliore (notamment avec l'obligation de transparence de l'exécutif), mais c'est pas encore ca. Et quand on voit que la France perd son droit de veto sur les points cruciaux, ca me fait peur.
Hum, à ceci prêt que si un jour il faut vraiment sortir les 20¤ que coute le disque, il y aura beaucoup moins de clients qu'aujourd'hui...
Comme avant qu'on puisse graver des CD quoi. Rien de nouveau sous le soleil.
Même si effectivement j'espère comme toi qu'ils vont s'en mordre les doigts, ils useront encore et toujours de leur force marketing pour appater le chaland et plus particulièrement les enfants : quand ton gamin hurle à la mort parcqu'il veut le dernier CD de la starac' comme tous ses petits copains, tu seras vraiment un père indigne de lui refuser ce produit que tu rejette pourtant mais qui l'aide à s'insérer dans la société (pour le moment limité à son cercle d'ami).
Désolé pour le "T'es vraiment naïf", mais les industriels ont réfléchi avant toi, ils préfèrent largement maîtriser de A à Z toute la chaîne sans possibilité de contournement, même s'ils peuvent perdre quelques clients (mais ces clients là sont déjà perdus j'ai envi de dire).
T'es vraiment naïf.
dans les cours d'école on écoutera ce qu'on te bourre dans le crâne tous les soirs à 21h (clin d'oeil décalé d'1h) sur M6/TF1/CocaCola/Universal/McDo&Co
Oué bah nos représentant direct c'est nos députés européens, et eux ne peuvent rien faire. De plus avec ce qu'on nous propose dans le TCE la France n'aura plus le droit de veto (qui ne persiste que dans le domaine social et environnemental)
voici 2 sites importants où tu peux chercher des composants .NET :
www.sharptoolbox.com (on peut filtrer les composants gratuits)
www.codeproject.com (beaucoup de tutoriaux avec la plupart du temps les sources correspondants)
[^] # Re: Nécessité de Java?
Posté par TImaniac (site web personnel) . En réponse à la dépêche Accord entre la FSF et les développeurs OpenOffice au sujet de l'utilisation de Java. Évalué à 2.
bon ben en tout cas j'ai pas d'exception comme en Java mais c'est affreusement lent comparé à C#
(à vrai dire j'ai lancé le test avant d'écrire le début de ce post et c'est toujours pas fini d'exécuté ;) )
(j'ai mis le fichier test.cpp dans le même dossier que les .cs et .java)
[^] # Re: Nécessité de Java?
Posté par TImaniac (site web personnel) . En réponse à la dépêche Accord entre la FSF et les développeurs OpenOffice au sujet de l'utilisation de Java. Évalué à 2.
Les generics en Java c'est du sucre syntaxique, il n'y a aucun gain de performance liés justement au fait qu'une classe peut être paramètrée par un type primitif, alors que l'implémentation C# démontre clairement que c'est possible et qu'il y a un gain qui est loin d'être négligeable (pour la même raison qu'il existe les types primitifs justement).
Les generics, en plus d'assurer un typage fort, permettent (en C#, pas en Java) de limiter l'autoboxing dans bien des cas.
[^] # Re: Nécessité de Java?
Posté par TImaniac (site web personnel) . En réponse à la dépêche Accord entre la FSF et les développeurs OpenOffice au sujet de l'utilisation de Java. Évalué à 2.
Merci pour l'explication mais j'avais deviné, c'est d'ailleur cela que je voulais mettre en évidence par rapport à C# qui ne fait pas la même bêtise.
D'ailleurs, le code est discutable, ça ressemble plus à une démo.
Bah oui j'ai codé ca en 2 minutes à l'arrache.
pourquoi utiliser une List alors que l'on aurait put utliser un tableau de int puisque l'on connait la taille ?
Pour mettre en évidence un problème évident de conception dans les generics de Java. Met un random si ca t'amuse.
[^] # Re: Nécessité de Java?
Posté par TImaniac (site web personnel) . En réponse à la dépêche Accord entre la FSF et les développeurs OpenOffice au sujet de l'utilisation de Java. Évalué à 2.
[^] # Re: Nécessité de Java?
Posté par TImaniac (site web personnel) . En réponse à la dépêche Accord entre la FSF et les développeurs OpenOffice au sujet de l'utilisation de Java. Évalué à 1.
Enfin si ca t'amuse remplace le List par List dans le .cs, t'auras la même chose qu'en Java et ca ne changera strictement rien, il est pas débile non plus le compilo ;)
[^] # Re: Nécessité de Java?
Posté par TImaniac (site web personnel) . En réponse à la dépêche Accord entre la FSF et les développeurs OpenOffice au sujet de l'utilisation de Java. Évalué à 2.
j'ai testé sous zindows (désolé chui pas chez moa), avec J2SE 1.5.03, framework .NET 2.0 beta 2 et mono 1.1.7
En fait j'ai un joli "OutOfMemory : Java Heap space", quelle idée aussi d'allouer des entiers sur le tas franchement ;)
[^] # Re: Nécessité de Java?
Posté par TImaniac (site web personnel) . En réponse à la dépêche Accord entre la FSF et les développeurs OpenOffice au sujet de l'utilisation de Java. Évalué à 2.
Forcer de reconnaître qu'il y a tout de même de très mauvais choix de conception en Java ;)
[^] # Re: Ca existe déjà pour le 1) ...
Posté par TImaniac (site web personnel) . En réponse au journal Linux, les failles, les virus et le grand public. Évalué à 2.
[^] # Re: Dot Net roulaize, patents pas gratuites et pas sur tout .NET
Posté par TImaniac (site web personnel) . En réponse au journal Amer. Évalué à 3.
http://pascalfresnay.free.fr/monoweb/ar01s06s02.html#id2524299(...)
si vous avez des suggestions pour améliorer la question n'hésitez pas
[^] # Re: question
Posté par TImaniac (site web personnel) . En réponse à la dépêche Accord entre la FSF et les développeurs OpenOffice au sujet de l'utilisation de Java. Évalué à 1.
# question
Posté par TImaniac (site web personnel) . En réponse à la dépêche Accord entre la FSF et les développeurs OpenOffice au sujet de l'utilisation de Java. Évalué à 2.
[^] # Re: brevets MS, APIs "efficaces" avec d'autres languages comme C++
Posté par TImaniac (site web personnel) . En réponse au journal Amer. Évalué à 3.
Si tu trouves que changer le langage et forcer le programmeur à utiliser un pré-compilo c'est utiliser le C++ avec succès évidemment...
Sinon une partie de la réponse à ta question sur le pourquoi de Mono :
http://pascalfresnay.free.fr/monoweb/ar01s06s02.html#id2524145(...)
# pas obligé de pondre un .exe
Posté par TImaniac (site web personnel) . En réponse au journal Amer. Évalué à 10.
mcs code.cs -out:monprogramavecmonextension.truc
et hop t'as un .truc à la place d'un .exe qui marche très bien =)
=======>[]
[^] # Re: Hum
Posté par TImaniac (site web personnel) . En réponse au journal Copie privée : suite et fin ?. Évalué à 2.
[^] # Re: Hum
Posté par TImaniac (site web personnel) . En réponse au journal Copie privée : suite et fin ?. Évalué à 3.
plus de droits de veto sauf sur l'environnement et le social. En gros il va être très difficile de faire évoluer ces 2 domaines, alors que les autres, en particulier le domaine économique est soumis à la majorité. Chaque ses préférences mais perso j'aurai préférer inverser les domaines et compétences. Rien que pour ca je trouves que c'est une dégradation.
De plus comme je le signalais même si le fonctionnement n'était pas démocratique (l'exécutif qui fait tout), il y avait au moins le droit de veto, et donc il fallait une certaine forme de consensus, si les 25 sont d'accord il y avait tout de même de fortes chances que l'idée ne soit pas trop stupide. Là on applique le principe de majorité à l'exécutif, c'est la porte ouverte à toute forme de décisions et de lois. Là encore je trouve que c'est une nette regression, pour ma part ca sera donc non.
[^] # Re: C'est plutôt une bonne chose
Posté par TImaniac (site web personnel) . En réponse au journal Copie privée : suite et fin ?. Évalué à 5.
Il y aura toujours la prise analogique MIC sur la carte son, et donc la possibilité d'avoir un contenu sans DRM (à moins qu'ils ne veulent même pas qu'on écoute la chatte du voisin miauler à 4h du mat' dans le métro)... Donc non, il n'y aura rien de neuf sous le soleil. Les gens ne passeront plus par eMule et comme au bon vieux temps se refileront les CD en main propre ou se les échangeront sur des réseaux privés (cercle d'ami virtuel).
Enfin tout ca pour dire qu'il ne faut absolument pas se laisser faire en s'imaginait "naïvement" que le seul perdant dans l'histoire sera l'industrie que sciera la branche sur laquelle elle est assise : on veut nous supprimer un droit important, ne l'oublions pas.
[^] # Re: L'ordinateur pas l'idéal pour jouer ???
Posté par TImaniac (site web personnel) . En réponse au journal Les jeux vidéos de demain (PS 3). Évalué à 5.
- les FPS
- les simulations de vol
- les MMPORG
- les RTS
euh, il reste quoi ? Ah oui les jeux de bagnole et les karaokés. Y'a rien à dire le PC pour jouer, c'est vraiment mort. D'ailleur on se demande ce que font tous ses ados (entre 10 et 30 ans) tous les we avec leur pc dans des salles des fêtes...
# id
Posté par TImaniac (site web personnel) . En réponse au message Un IDE pour la Glib. Évalué à 0.
ou KDevelop ?
[^] # Re: Hum
Posté par TImaniac (site web personnel) . En réponse au journal Copie privée : suite et fin ?. Évalué à 4.
Il suffit de voir l'affaire des brevets qu'il est bien plus facile d'approcher les parlementaires que les membres du conseil.
Bah oui c'est tout le problème : on nous refile entre les doigts une démocratie parlementaire mais en réalité c'est pas elle qui a les pouvoirs mais l'exécutif au-dessus, avec un tampon au milieu : la comission.
Avec le TCE ca s'améliore (notamment avec l'obligation de transparence de l'exécutif), mais c'est pas encore ca. Et quand on voit que la France perd son droit de veto sur les points cruciaux, ca me fait peur.
[^] # Re: C'est plutôt une bonne chose
Posté par TImaniac (site web personnel) . En réponse au journal Copie privée : suite et fin ?. Évalué à 3.
Comme avant qu'on puisse graver des CD quoi. Rien de nouveau sous le soleil.
Même si effectivement j'espère comme toi qu'ils vont s'en mordre les doigts, ils useront encore et toujours de leur force marketing pour appater le chaland et plus particulièrement les enfants : quand ton gamin hurle à la mort parcqu'il veut le dernier CD de la starac' comme tous ses petits copains, tu seras vraiment un père indigne de lui refuser ce produit que tu rejette pourtant mais qui l'aide à s'insérer dans la société (pour le moment limité à son cercle d'ami).
Désolé pour le "T'es vraiment naïf", mais les industriels ont réfléchi avant toi, ils préfèrent largement maîtriser de A à Z toute la chaîne sans possibilité de contournement, même s'ils peuvent perdre quelques clients (mais ces clients là sont déjà perdus j'ai envi de dire).
[^] # Re: C'est plutôt une bonne chose
Posté par TImaniac (site web personnel) . En réponse au journal Copie privée : suite et fin ?. Évalué à 3.
dans les cours d'école on écoutera ce qu'on te bourre dans le crâne tous les soirs à 21h (clin d'oeil décalé d'1h) sur M6/TF1/CocaCola/Universal/McDo&Co
[^] # Re: Hum
Posté par TImaniac (site web personnel) . En réponse au journal Copie privée : suite et fin ?. Évalué à 4.
# ayé
Posté par TImaniac (site web personnel) . En réponse au message MediaWiki et pages perso Free. Évalué à 2.
[^] # Re: Un peu HS, mais j'en profite pour demander
Posté par TImaniac (site web personnel) . En réponse au journal Un petit site sur Mono en français. Évalué à 3.
www.sharptoolbox.com (on peut filtrer les composants gratuits)
www.codeproject.com (beaucoup de tutoriaux avec la plupart du temps les sources correspondants)
[^] # Re: yeeh de la doc en français :)
Posté par TImaniac (site web personnel) . En réponse au journal Un petit site sur Mono en français. Évalué à 2.