Hi there !
I don't know when exactly it was improved, but following notice in
https://www.postgresql.org/docs/current/static/textsearch-controls.html#TEXTSEARCH-HEADLINE
is currently not needed.
ts_headline uses the original document, not a tsvector summary, so it can
be slow and should be used with care. A typical mistake is to call
ts_headline for every matching document when only ten documents are to be
shown. SQL subqueries can help; here is an example:
Regards,
Oleg