Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Stupid Programmer Tricks - Part 4
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Stupid Programmer Tricks - Part 4
Divers
Thread ID:
00823580
Message ID:
00823580
Vues:
45
I don't know if there's a better way to do this, but I recently I noted when I BROWSEd a view from the Database Design it took quite a long time (there were about 235,000 rows, with 12 bytes per row) for the table to load into memory completely. I also noted that the process speeded up considerably when I moved the mouse. This reminded me of my friend David Frankenbach's DoFastEvents programming.

While this is really useless in most situations (and therefore qualifies it as a "Stupid Programmer Trick") when dealing with a properly designed client/server application (I mean you just don't go around retrieving 200,000+ records at a shot in C/S). I thought it provides some insight into how, in a crunch, a little awareness can help you speed things up. Therefore....
LOCAL lnreccount, lni, lnrow, lncol,;
  lnstart, lnstop
lnrow = MROW("", 3)
lncol = MCOL("", 3)
lnreccount = 0
lni = 0
lnstart = SECONDS()
* Or any table with a lot of records
USE shop_order_roll AGAIN IN 0
SELECT Shop_order_roll
DO WHILE lnreccount # RECCOUNT()
  lni = lni + 1
  IF lni % 2 = 0 THEN
    MOUSE AT lnrow, lncol + 1 PIXELS
  ELSE
    MOUSE AT lnrow, lncol PIXELS
  ENDIF
  lnreccount = RECCOUNT()
ENDDO
lnstop = SECONDS()
? lnstop - lnstart
USE
USE shop_order_roll AGAIN IN 0
SELECT Shop_order_roll
DO WHILE lnreccount # RECCOUNT()
  lnreccount = RECCOUNT()
ENDDO
lnstop = SECONDS()
? lnstop - lnstart
In the above, the first open took approximately half the time (4.837 vs. 9.223).
George

Ubi caritas et amor, deus ibi est
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform