这是indexloc提供的服务,不要输入任何密码
Skip to content

TextDecoding pretty slow #447

@lal12

Description

@lal12

I recently wondered why TextDecoding was so slow. Several seconds for 50-100 Kbytes (I am running on a low power embedded system with single core performance comparable to RPI 1).

I saw it currently uses a JS only implementation. I am wondering why, the JS_NewStringLen of quickjs already handles utf8 doesn't it?

As a workaround I am currently using

import FFI from 'tjs:ffi';
export function quickDecodeUtf8(buf) {
    return FFI.bufferToString(buf);
}

Which also just does a JS_NewString.

The opposite case of Encoding isn't quite as slow, but it seems JS_ToCString would also handle this case.

Though maybe I am missing something, e.g. some feature TextEncoder/TextDecoder which would not be happening/handled in the quickjs functions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions