Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Showing
with 307 additions and 0 deletions
File added
package p4a;
public class MainArrayListStdAddDebut {
public static void main(String[] args) {
ArrayListStd<Integer> arrayListStd = new ArrayListStd<Integer>();
int nbOperation = Integer.parseInt(args[0]);
for (int i = 0; i < nbOperation; i++) {
arrayListStd.ajout(0, 0);
}
}
}
package p4a;
public class MainArrayListStdAddFin {
public static void main(String[] args) {
ArrayListStd<Integer> arrayListStd = new ArrayListStd<Integer>();
int nbOperation = Integer.parseInt(args[0]);
for (int i = 0; i < nbOperation; i++) {
arrayListStd.ajout(0, i);
}
}
}
File added
package p4a;
public class MainLinkedListPersoAddDebut {
public static void main(String[] args) {
LinkedListPerso<Integer> linkedListStd = new LinkedListPerso<Integer>();
int nbOperation = Integer.parseInt(args[0]);
for (int i = 0; i < nbOperation; i++) {
linkedListStd.ajout(0, 0);
}
}
}
package p4a;
public class MainLinkedListPersoAddFin {
public static void main(String[] args) {
LinkedListPerso<Integer> linkedListStd = new LinkedListPerso<Integer>();
int nbOperation = Integer.parseInt(args[0]);
for (int i = 0; i < nbOperation; i++) {
linkedListStd.ajout(0, i);
}
}
}
File added
package p4a;
public class MainLinkedListStdAddDebut {
public static void main(String[] args) {
LinkedListStd<Integer> linkedListStd = new LinkedListStd<Integer>();
int nbOperation = Integer.parseInt(args[0]);
for (int i = 0; i < nbOperation; i++) {
linkedListStd.ajout(0, 0);
}
}
}
package p4a;
public class MainLinkedListStdAddFin {
public static void main(String[] args) {
LinkedListStd<Integer> linkedListStd = new LinkedListStd<Integer>();
int nbOperation = Integer.parseInt(args[0]);
for (int i = 0; i < nbOperation; i++) {
linkedListStd.ajout(0, i);
}
}
}
package p4a;
public class MainTableauPersoAdd {
public static void main(String[] args) {
int nbOperation = Integer.parseInt(args[0]);
TableauPerso tabStd = new TableauPerso(nbOperation);
for (int i = 0; i < nbOperation; i++) {
tabStd.ajout(0, i);
}
}
}
package p4a;
public class MainTableauStdAdd {
public static void main(String[] args) {
int nbOperation = Integer.parseInt(args[0]);
TableauStd tabStd = new TableauStd(nbOperation);
for (int i = 0; i < nbOperation; i++) {
tabStd.ajout(0, i);
}
}
}
File added
package p4a;
public interface Structure {
public void ajout(Object element, int position);
public void suppression(int position);
public Object acces(int position);
}
File added
package p4a;
public class TableauPerso implements Structure{
private Object[] tableau;
private int nbElements;
public TableauPerso(int taille) {
if (taille < 0) {
throw new IllegalArgumentException("TableauPerso : taille negative " + taille);
}
this.tableau = new Object[taille];
nbElements = 0;
}
@Override
public void ajout(Object element, int position) {
if (position < 0 || position > nbElements) {
throw new IndexOutOfBoundsException("ajout : mauvais index " + position);
}
if (nbElements >= tableau.length) {
throw new IllegalStateException("ajout : tableau plein");
}
for (int i = nbElements; i > position; i--) {
tableau[i] = tableau[i - 1];
}
tableau[position] = element;
nbElements++;
}
@Override
public void suppression(int position) {
if (position < 0 || position >= nbElements) {
throw new IndexOutOfBoundsException("suppression : position incorrecte " + position);
}
for (int i = position + 1; i < nbElements; i++) {
tableau[i - 1] = tableau[i];
}
nbElements--;
}
@Override
public Object acces(int position) {
if (position > tableau.length || position < 0) {
throw new IllegalArgumentException("acces : position incorecte");
}
return tableau[position];
}
}
File added
package p4a;
public class TableauStd implements Structure {
private Object[] tableau;
public TableauStd(int taille) {
if (taille < 0) {
throw new IllegalArgumentException("TableauStd : taille negative " + taille);
}
this.tableau = new Object[taille];
}
@Override
public void ajout(Object element, int position) {
if (position > tableau.length) {
throw new UnsupportedOperationException("ajout : operation non supportee (taille depassee)");
}
else tableau[position] = element;
}
@Override
public void suppression(int position) {
throw new UnsupportedOperationException("suppression : operation non supportee");
}
@Override
public Object acces(int position) {
if (position > tableau.length || position < 0) {
throw new IllegalArgumentException("acces : position incorecte");
}
return tableau[position];
}
}
NbOperations,Version,CPU,Mem
100000,ArrayListStd,0.92,51480
100000,ArrayListStd,0.95,56940
100000,ArrayListStd,0.92,56776
100000,LinkedListStd,0.10,52112
100000,LinkedListStd,0.09,53852
100000,LinkedListStd,0.08,52200
125000,ArrayListStd,1.55,54820
125000,ArrayListStd,1.52,52968
125000,ArrayListStd,1.48,54828
125000,LinkedListStd,0.09,54064
125000,LinkedListStd,0.08,56140
125000,LinkedListStd,0.10,54168
150000,ArrayListStd,2.31,57088
150000,ArrayListStd,2.12,51980
150000,ArrayListStd,2.11,56308
150000,LinkedListStd,0.09,55792
150000,LinkedListStd,0.09,56036
150000,LinkedListStd,0.10,54148
175000,ArrayListStd,2.89,52024
175000,ArrayListStd,3.13,50152
175000,ArrayListStd,3.19,54896
175000,LinkedListStd,0.11,61116
175000,LinkedListStd,0.10,60140
175000,LinkedListStd,0.09,61112
200000,ArrayListStd,4.17,53848
200000,ArrayListStd,3.97,53180
200000,ArrayListStd,3.77,52120
200000,LinkedListStd,0.10,56440
200000,LinkedListStd,0.10,60040
200000,LinkedListStd,0.10,60172
225000,ArrayListStd,4.77,49972
225000,ArrayListStd,4.78,54088
225000,ArrayListStd,4.77,56096
225000,LinkedListStd,0.10,58104
225000,LinkedListStd,0.10,56340
225000,LinkedListStd,0.12,61356
250000,ArrayListStd,5.88,56984
250000,ArrayListStd,5.89,55976
250000,ArrayListStd,5.97,53852
250000,LinkedListStd,0.12,60876
250000,LinkedListStd,0.09,60288
250000,LinkedListStd,0.11,60244
275000,ArrayListStd,7.13,53848
275000,ArrayListStd,7.09,54256
275000,ArrayListStd,7.11,56284
275000,LinkedListStd,0.10,58288
275000,LinkedListStd,0.10,58044
275000,LinkedListStd,0.09,61472
300000,ArrayListStd,8.55,52108
300000,ArrayListStd,8.48,51784
300000,ArrayListStd,8.62,56328
300000,LinkedListStd,0.10,59400
300000,LinkedListStd,0.12,59320
300000,LinkedListStd,0.08,58440
#!/bin/bash
#Compare l'operation d'ajout en tete de liste sur les ArrayList et LinkedList standards
TESTS=3
STRUCT=2
NBOPERATIONS="100000 125000 150000 175000 200000 225000 250000 275000 300000"
echo "NbOperations,Version,CPU,Mem"
for nb in $NBOPERATIONS
do
for i in `seq $STRUCT`
do
for j in `seq $TESTS`
do
if [ $i = 1 ]
then
res=`(/usr/bin/time -f "%U,%M" java p4a.MainArrayListStdAddDebut $nb > /dev/null) 2>&1`
echo "$nb,ArrayListStd,$res"
else
res=`(/usr/bin/time -f "%U,%M" java p4a.MainLinkedListStdAddDebut $nb > /dev/null) 2>&1`
echo "$nb,LinkedListStd,$res"
fi
done
done
done
\ No newline at end of file
#!/bin/bash
STRUCT=3
NBOPERATIONS="25000 50000 75000 100000 250000 500000"
echo "Taille,Version,CPU,Mem"
for $nb in $NBOPERATIONS
do
for i in `seq $STRUCT`
do
if [ $i = 1 ]
then
res=`(/usr/bin/time -f "%U,%M" java p4a.MainArrayListStd $nb > /dev/null) 2>&1`
echo "$nb,ArrayListStd,$res"
elif [ $i = 2 ]
then
res=`(/usr/bin/time -f "%U,%M" java p4a.MainLinkedListStd $nb > /dev/null) 2>&1`
echo "$nb,LinkedListStd,$res"
else
res=`(/usr/bin/time -f "%U,%M" java p4a.MainArrayStd $nb > /dev/null) 2>&1`
echo "$nb,ArrayStd,$res"
fi
done
done
\ No newline at end of file