Most reading and writing is done in utils.c, but this does not include sed.h or the "unlocked-io.h" header.
ltrace sed '' < <(seq 1 100)
Shows lots of calls to the locked system calls.
Adding include "sed.h" in utils.c and recompling and re-running ltrace shows the _unlocked() variants being used.
This improves the performance when reading the output of seq 1 1e8 from 9.5 seconds to 6.4 seconds. ie:
time sed '' < seq.1e8 >/dev/null
(on ubuntu 16.04 with skylake processor)