undici
undici copied to clipboard
fetch: limit web streams usage in body mixin methods
This PR aims to improve performance by optimizing the processing of webflows in the fetch module. This experiment was already done by @KhafraDev , I just opened a pr
I thought there would be discussion about it and it might benefit fetch ๐ #2164 here is a benchmark made by @KhafraDev ๐ benchmarks:
import { Response as UndiciResponse } from './index.js'
import { cronometro } from 'cronometro'
await cronometro({
async 'undici Response' () {
await new UndiciResponse('abc').text()
},
async 'global Response' () {
await new Response('abc').text()
}
})
โโโโโโโโโโโโโโโโโโโคโโโโโโโโโโคโโโโโโโโโโโโโโโโโโคโโโโโโโโโโโโ
โ Slower tests โ Samples โ Result โ Tolerance โ
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโข
โ global Response โ 10000 โ 40169.19 op/sec โ ยฑ 1.59 % โ
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโข
โ Fastest test โ Samples โ Result โ Tolerance โ
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโข
โ undici Response โ 10000 โ 44024.31 op/sec โ ยฑ 2.12 % โ
โโโโโโโโโโโโโโโโโโโงโโโโโโโโโโงโโโโโโโโโโโโโโโโโโงโโโโโโโโโโโโ
I'm running tests, I'll fix them ๐งช
There are related failures, but I don't necessarily think this should land as-is even if those failures were fixed.
I wonder if you have a suggestion, if it's healthy to keep it as it is, I'll close this place @KhafraDev