官术网_书友最值得收藏!

I/O-bound

I/O-bound, on the other hand, are algorithms that rely on input/output devices, so their execution times depend on the speed of those devices, for example, an algorithm that reads a file and passes each word in the document to filterPalindromes() in order to print the palindromes in the document. Changing a few lines of the previous example will do:

fun main(args: Array<String>) {
val words = readWordsFromJson("resources/words.json")

filterPalindromes(words).forEach {
println(it)
}
}

The readWordsFromJson() function will read the file from the filesystem. This is an I/O operation that will depend on the speed at which the file can be read. If the file is stored in a hard drive, the performance of the application will be worse than if the file is stored in an SSD, for example.

Many other operations, such as networking or receiving input from the peripherals of the computer, are also I/O operations. Algorithms that are I/O-bound will have performance bottleneck based on the I/O operations, and this means that optimizations are dependent on external systems or devices.

Many I/O-bound, high-performance applications, such as databases, may end up being as fast as the access to the storage of the machine they are running on. Networking-based applications, like many phone apps, will perform based on the speed of their connectivity to the internet.

主站蜘蛛池模板: 潜江市| 临朐县| 平顶山市| 扶风县| 璧山县| 平武县| 灵川县| 永安市| 前郭尔| 萝北县| 景东| 龙州县| 苏尼特左旗| 铜陵市| 昌黎县| 景洪市| 宁城县| 思南县| 资讯 | 梓潼县| 徐州市| 永仁县| 木里| 新巴尔虎左旗| 怀安县| 肇庆市| 民勤县| 托克逊县| 鄂尔多斯市| 宣恩县| 贵州省| 水富县| 达州市| 措勤县| 鲁甸县| 万山特区| 喜德县| 宜阳县| 临汾市| 常宁市| 武穴市|