views:

70

answers:

2

In my database(mysql), I have a table which has 50k data(rows/records).

I do a test using firebug, after playing the game, the call to load_score.php and save_score.php is around 380ms (millisecond).

The save_score.php just a normal inserting, nothing much. The load_score.php, I use this query:

SELECT name, score
FROM `highscores`
WHERE id =1
LIMIT 0, 10
  • The result returns 10 rows
  • the query returns in 0.0005 seconds (tested using phpmyadmin)
  • I echoed the data back to flash.

But on my game (flash), it tooks 11 seconds(count manually) to load and save the score. Why the time differences is so big?

Could it be the problem when Flash received php data, the process to display is slow??

Are there any others reasons on why the displaying take longer time??

(If you need more information, please let me know)

Firebug Testing Result:

================================================================
=       File       |   firebug time   |   actual/on web time   =
================================================================
=   load_score.php |      435 ms      | 5 seconds(before it calls save_score.php)
=   save_score.php |      643 ms      | 4-5 seconds(before displaying highscore table)
================================================================

So the total time to display the highscore = ~10 seconds

A: 

Not 'the' answer, but you might save up to 5 seconds by combining both requests into one. Have the save script also return the high score table. You will at least save half a second (transfer time reported by firebug) and maybe more if there's a delay in flash for some reason.

The comments above should point you in the right direction in solving or at least identifying the root cause.

stroop
A: 

Another approach is to use amfphp library and thus send/receive data in Flash native AMF format which Flash can fast way faster.

Michael Pliskin