From WikiChip
Editing schlemiel the painter's algorithm
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
This page supports semantic in-text annotations (e.g. "[[Is specified as::World Heritage Site]]") to build structured and queryable content provided by Semantic MediaWiki. For a comprehensive description on how to use annotations or the #ask parser function, please have a look at the getting started, in-text annotation, or inline queries help pages.
Latest revision | Your text | ||
Line 51: | Line 51: | ||
</pre> | </pre> | ||
− | If the function was to be used on a simple file with 2 lines, function ''file_get_line'' will end up reading line 1 to get the first line and then it will read line one again and line two to get to the second line, resulting in 3 line scans. If the file was to have 10 lines, ''file_get_line'' will end up reading a total of 55 lines ( | + | If the function was to be used on a simple file with 2 lines, function ''file_get_line'' will end up reading line 1 to get the first line and then it will read line one again and line two to get to the second line, resulting in 3 line scans. If the file was to have 10 lines, ''file_get_line'' will end up reading a total of 55 lines (\(\sum\limits_{i=1}^{10} i\)) over and over. It can be seen that the number of operations done grows very quickly even for moderately small files. A file with just 10,000 lines which could usually be read in just 10,000 seeks will result in \(\sum\limits_{i=1}^{10000} i = {50,005,000}\) seeks with this implementation. |
== External links == | == External links == |