18.02.2012, 16:08
Quote:
Simply setting the cache to true in mysql_function_query won't do the trick, you need to use the cache functions in the returning callback as well.
cache_get_data returns stores the amount of rows and fields in the given parameters. This is useful for checking validity of what a SELECT query outputs and looping through the results as well. cache_get_row stores the field data in the destination string. It is as simple as that: pawn Код:
There's also cache_get_field_content which will get the data by the field's name, for example: pawn Код:
I have a house loading/parsing function which runs on startup only. When using the regular method (store the result, put mysql_fetch_row_format in a loop, etc), it took around 2.5 seconds to execute. I converted that function to use the cache method and the differences are slightly astonishing! For the sake of it, I searched them out in my outbox (sent to xxmitsu previously), and for the old method, all mysql_fetch_row calls took ~3000ms, sscanf parsing took ~30ms and other parts of code in the loop ~130ms. After converting, the whole execution time is ~300ms, cache functions take around 160ms of it. I didn't run very many tests, but when starting the server up on Windows, I can clearly tell that the gain in startup is literally seconds! |
Anyway, is anyone using the latest version in a LIVE server?