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

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.

主站蜘蛛池模板: 克东县| 清流县| 城市| 华蓥市| 海南省| 桂林市| 上犹县| 博客| 邛崃市| 会昌县| 丰都县| 惠安县| 彭阳县| 安阳县| 视频| 广昌县| 蓬安县| 和静县| 塔城市| 东丰县| 黄石市| 兰州市| 石首市| 永宁县| 大港区| 阜新市| 旌德县| 监利县| 伊吾县| 高陵县| 南郑县| 镇坪县| 阳春市| 涟源市| 邵阳县| 海盐县| 广德县| 铜陵市| 耿马| 湟中县| 昭平县|