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

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.

主站蜘蛛池模板: 精河县| 古丈县| 通辽市| 平顺县| 讷河市| 新津县| 五常市| 保亭| 抚顺市| 阿瓦提县| 新绛县| 宁明县| 拜城县| 景德镇市| 清新县| 科技| 宕昌县| 阳信县| 鄄城县| 栾川县| 聂荣县| 乌恰县| 德兴市| 百色市| 抚州市| 那曲县| 达拉特旗| 增城市| 宽城| 西乌珠穆沁旗| 浦县| 沙坪坝区| 吉木乃县| 云南省| 崇文区| 方城县| 亚东县| 囊谦县| 大埔县| 个旧市| 司法|