Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small improvements #2

Merged
merged 1 commit into from
Dec 31, 2024
Merged

small improvements #2

merged 1 commit into from
Dec 31, 2024

Conversation

terwey
Copy link
Contributor

@terwey terwey commented Dec 4, 2024

During usage of https://github.com/tiktoken-go/tokenizer I noticed that there was extensive usage of regexp2, which this library allows me to pre-compile.

I ran into some issues with the tooling, e.g. the go install mentioned won't work as the only tagged version is an older one which still refers to a replace in the go.mod. I also ran into some other issues as I was locally debugging, these were the small code changes I ended up with.

For instance the tokenizer library initialized the MustCompile inside a struct which this library doesn't (yet) support. Then on top it had concatenation for strings... so it took quite some effort to get it to work.

I really like this tooling and would love to see it get more traction as regexp are notoriously slow in Go.

PS: parts of the code was generated with ChatGPT but have been confirmed and tested by myself, just modern lazy evening programming ;)

@bluescreen10
Copy link

I'm also interested on these changes.

@dlclark dlclark merged commit 0f08d23 into dlclark:main Dec 31, 2024
@dlclark
Copy link
Owner

dlclark commented Dec 31, 2024

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants