[HELP] Optimum way to read a file
I coded a plugin that requires to read a file which contains 50-60 steam ids.
Currently, it reads the file whenever a player connects. Which way is optimum? Reading the file everytime or using an array to store its contents once and reading them instead? |
Re: [HELP] Optimum way to read a file
Doing something once, or doing something multiple times?
Once. ;) |
Re: [HELP] Optimum way to read a file
Quote:
Let me put it this way. Does it take more time & cpu consumption to read a file than looping through an array? |
Re: [HELP] Optimum way to read a file
Yes, ridiculously so.
|
Re: [HELP] Optimum way to read a file
Reading a file whenever a user connect is a poor way in this case.
You can use a trie instead of an array. |
Re: [HELP] Optimum way to read a file
Quote:
Trie for finding the steam id, and array contained the rest of the necessary data. |
Re: [HELP] Optimum way to read a file
You could use TrieSetArray/TrieGetArray; https://forums.alliedmods.net/showthread.php?t=201872
|
Re: [HELP] Optimum way to read a file
Quote:
Quote:
Best option could depend on content you have to store. |
All times are GMT -4. The time now is 20:27. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.