IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JavaScript Discussion :

Fonction très lourde


Sujet :

JavaScript

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    302
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2005
    Messages : 302
    Par défaut Fonction très lourde
    Bonjour,

    J’ai créé une fonction pour extraire des donné d’un grid 23000 row et sur 18 col, mais sur les navigateurs ex : explorer 2 heures puis ca ne bouge plus (fige) sur mozilla 2 heures puis carrément blanc (fige) et sur chrome 43 secondes donc fonctionne, mais la page n’est pas fluide.

    Avez une solution pour faire un genre de doevents comme vb SVP ou autre pour rafraîchir la fonction.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
     
     
    function button2 () {
    alert("Temps estimer a 90 secondes");
     
     
     
    // etape 1
    var row_count = table.getCount();
    var NB_row1 = 0;
    if (Category.getCellText(2, 0).length != 0) var row1_Category = Category.getCellText(1, 0);
    var NB_row2 = 0;
    if (Category.getCellText(2, 1).length != 0) var row2_Category = Category.getCellText(1, 1);
    var NB_row3 = 0;
    if (Category.getCellText(2, 2).length != 0) var row3_Category = Category.getCellText(1, 2);
    var NB_row4 = 0;
    if (Category.getCellText(2, 3).length != 0) var row4_Category = Category.getCellText(1, 3);
    var NB_row5 = 0;
    if (Category.getCellText(2, 4).length != 0) var row5_Category = Category.getCellText(1, 4);
    var NB_row6 = 0;
    if (Category.getCellText(2, 5).length != 0) var row6_Category = Category.getCellText(1, 5);
    var NB_row7 = 0;
    if (Category.getCellText(2, 6).length != 0) var row7_Category = Category.getCellText(1, 6);
    var NB_row8 = 0;
    if (Category.getCellText(2, 7).length != 0) var row8_Category = Category.getCellText(1, 7);
    var NB_row9 = 0;
    if (Category.getCellText(2, 8).length != 0) var row9_Category = Category.getCellText(1, 8);
    var NB_row10 = 0;
    if (Category.getCellText(2, 9).length != 0) var row10_Category = Category.getCellText(1, 9);
    var NB_row11 = 0;
    if (Category.getCellText(2, 10).length != 0) var row11_Category = Category.getCellText(1, 10);
    var NB_row12 = 0;
    if (Category.getCellText(2, 11).length != 0) var row12_Category = Category.getCellText(1, 11);
    var NB_row13 = 0;
    if (Category.getCellText(2, 12).length != 0) var row13_Category = Category.getCellText(1, 12);
    var NB_row14 = 0;
    if (Category.getCellText(2, 13).length != 0) var row14_Category = Category.getCellText(1, 13);
    label0:
    for(var row=0;row<row_count;row++) { 
    label1:
    for(var row2=0;row2<Category.getRowCount();row2++) { 
    if (Category.getCellText(2, 0).length != 0) if (Category.getCellText(1, 0) == obj.getCellText(0, row) && NB_row1 == Category.getCellText(2, 0)) break label1; 
    if (Category.getCellText(2, 1).length != 0) if (Category.getCellText(1, 1) == obj.getCellText(0, row) && NB_row2 == Category.getCellText(2, 1)) break label1; 
    if (Category.getCellText(2, 2).length != 0) if (Category.getCellText(1, 2) == obj.getCellText(0, row) && NB_row3 == Category.getCellText(2, 2)) break label1; 
    if (Category.getCellText(2, 3).length != 0) if (Category.getCellText(1, 3) == obj.getCellText(0, row) && NB_row4 == Category.getCellText(2, 3)) break label1; 
    if (Category.getCellText(2, 4).length != 0) if (Category.getCellText(1, 4) == obj.getCellText(0, row) && NB_row5 == Category.getCellText(2, 4)) break label1; 
    if (Category.getCellText(2, 5).length != 0) if (Category.getCellText(1, 5) == obj.getCellText(0, row) && NB_row6 == Category.getCellText(2, 5)) break label1;  
    if (Category.getCellText(2, 6).length != 0) if (Category.getCellText(1, 6) == obj.getCellText(0, row) && NB_row7 == Category.getCellText(2, 6)) break label1; 
    if (Category.getCellText(2, 7).length != 0) if (Category.getCellText(1, 7) == obj.getCellText(0, row) && NB_row8 == Category.getCellText(2, 7)) break label1; 
    if (Category.getCellText(2, 8).length != 0) if (Category.getCellText(1, 8) == obj.getCellText(0, row) && NB_row9 == Category.getCellText(2, 8)) break label1; 
    if (Category.getCellText(2, 9).length != 0) if (Category.getCellText(1, 9) == obj.getCellText(0, row) && NB_row10 == Category.getCellText(2, 9)) break label1; 
    if (Category.getCellText(2, 10).length != 0) if (Category.getCellText(1, 10) == obj.getCellText(0, row) && NB_row11 == Category.getCellText(2, 10)) break label1;  
    if (Category.getCellText(2, 11).length != 0) if (Category.getCellText(1, 11) == obj.getCellText(0, row) && NB_row12 == Category.getCellText(2, 11)) break label1;  
    if (Category.getCellText(2, 12).length != 0) if (Category.getCellText(1, 12) == obj.getCellText(0, row) && NB_row13 == Category.getCellText(2, 12)) break label1; 
    if (Category.getCellText(2, 13).length != 0) if (Category.getCellText(1, 13) == obj.getCellText(0, row) && NB_row14 == Category.getCellText(2, 13)) break label1; 
    //
    if(Category.getCellText(1, row2) == obj.getCellText(0, row)) {
    //
    if (Category.getCellText(2, 0).length != 0) if(row1_Category == obj.getCellText(0, row)) NB_row1 = (NB_row1 +1);
    if (Category.getCellText(2, 1).length != 0) if(row2_Category == obj.getCellText(0, row)) NB_row2 = (NB_row2 +1);
    if (Category.getCellText(2, 2).length != 0) if(row3_Category == obj.getCellText(0, row)) NB_row3 = (NB_row3 +1);
    if (Category.getCellText(2, 3).length != 0) if(row4_Category == obj.getCellText(0, row)) NB_row4 = (NB_row4 +1);
    if (Category.getCellText(2, 4).length != 0) if(row5_Category == obj.getCellText(0, row)) NB_row5 = (NB_row5 +1);
    if (Category.getCellText(2, 5).length != 0) if(row6_Category == obj.getCellText(0, row)) NB_row6 = (NB_row6 +1);
    if (Category.getCellText(2, 6).length != 0) if(row7_Category == obj.getCellText(0, row)) NB_row7 = (NB_row7 +1);
    if (Category.getCellText(2, 7).length != 0) if(row8_Category == obj.getCellText(0, row)) NB_row8 = (NB_row8 +1);
    if (Category.getCellText(2, 8).length != 0) if(row9_Category == obj.getCellText(0, row)) NB_row9 = (NB_row9 +1);
    if (Category.getCellText(2, 9).length != 0) if(row10_Category == obj.getCellText(0, row)) NB_row10 = (NB_row10 +1);
    if (Category.getCellText(2, 10).length != 0) if(row11_Category == obj.getCellText(0, row)) NB_row11 = (NB_row11 +1);
    if (Category.getCellText(2, 11).length != 0) if(row12_Category == obj.getCellText(0, row)) NB_row12 = (NB_row12 +1);
    if (Category.getCellText(2, 12).length != 0) if(row13_Category == obj.getCellText(0, row)) NB_row13 = (NB_row13 +1);
    if (Category.getCellText(2, 13).length != 0) if(row14_Category == obj.getCellText(0, row)) NB_row14 = (NB_row14 +1);
    //
      for(var j=5;j<6;j++) { 
            data += '"'+(obj.getCellText(j, row).toLowerCase().replace(/ /g, '-').replace('---', '-').replace('--', '-')); // Minuscules
    		if(j > 0) data += '",'; 
       } 
      for(var j=5;j<6;j++) { 
            data += '"'+obj.getCellText(j, row); 
    		if(j > 0) data += '",'; 
       } 
      for(var j=6;j<7;j++) { 
            data += '"'+obj.getCellText(j, row); 
    		if(j > 0) data += '",'; 
       } 
      for(var j=4;j<5;j++) { 
            data += '"'+obj.getCellText(j, row); 
    		if(j > 0) data += '",'; 
       } 
      for(var j=0;j<1;j++) { 
            data += '"'+obj.getCellText(j, row); 
    		if(j > 0) data += '",'; 
       } 
      for(var j=5;j<6;j++) { 
            data += '","'+obj.getCellText(j, row); 
    	if(j > 0) data += '",'; 
       } 
      for(var j=1;j<2;j++) { 
            data += '"'+obj.getCellText(j, row); 
    		if(j > 0) data += '",'; 
       } 
      for(var j=2;j<3;j++) { 
            data += '"'+obj.getCellText(j, row); 
    		if(j > 0) data += '",'; 
       } 
      for(var j=1;j<2;j++) { 
      data += ''; 
    		if(j > 0) data += ',,,,'; 
       } 
      for(var j=3;j<4;j++) { 
            data += '"'+obj.getCellText(j, row); 
    		if(j > 0) data += '",'; 
       } 
      for(var j=12;j<13;j++) { 
            data += '"'+obj.getCellText(j, row); 
    if(j > 0) data += '",'; 
       } 
      for(var j=2;j<3;j++) { 
            data += '"'+''; 
    if(j > 0) data += '",'; 
       } 
      for(var j=2;j<3;j++) { 
            data += '"'+'6","deny","manual'; 
    if(j > 0) data += '",'; 
       } 
      for(var j=9;j<10;j++) { 
            data += '"'+obj.getCellText(j, row); 
    if(j > 0) data += '",,"true","true",'; 
       } 
      for(var j=10;j<11;j++) { 
            data += '"'+obj.getCellText(j, row); 
    		if(j > 0) data += '"'; 
       } 
       data += "\r\n";
    }}} 
    //
     
     
    // suite du code
    Merci d'avance

  2. #2
    Expert confirmé
    Avatar de Auteur
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    7 660
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 7 660
    Par défaut
    bonsoir,

    un tableau de 23000 lignes et 18 colonnes ??
    Que contient ce tableau ? Est-ce vraiment nécessaire de tout afficher ?

    Et ce code n'est franchement pas optimisé


    Tu as oublié de préciser ici que tu utilises cette bibliothèque : http://www.activewidgets.com/ (oui j'ai vu que tu avais posté ce même message dans un autre forum).

  3. #3
    Membre éclairé
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    302
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2005
    Messages : 302
    Par défaut
    J’ai tous recommencé en java ultra rapide
    Merci

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Optimisation d'une requête très lourde
    Par Benji76 dans le forum Requêtes
    Réponses: 9
    Dernier message: 24/02/2007, 11h35
  2. Réponses: 2
    Dernier message: 07/02/2007, 18h31
  3. Sauvegarde .txt : fichiers très lourds
    Par benjamin.retho dans le forum MATLAB
    Réponses: 5
    Dernier message: 06/11/2006, 12h51
  4. problème bd trés lourde
    Par greg64 dans le forum Access
    Réponses: 2
    Dernier message: 23/05/2006, 06h40

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo