tiktoken icon indicating copy to clipboard operation
tiktoken copied to clipboard

Performance

Open steebchen opened this issue 1 year ago • 0 comments

This is a pretty cool library! I'm doing something like this:

while (enc.encode(raw).length > length) {
  raw = raw.slice(0, -1000)
}

to truncate big data, however this is quite slow (running this 100 times can take like 1-2 seconds).

Is there any better way to do this or can I optimize this somehow?

steebchen avatar Apr 15 '24 08:04 steebchen