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

Remove the encoding cache #516

Merged
merged 1 commit into from
Mar 29, 2023
Merged

Remove the encoding cache #516

merged 1 commit into from
Mar 29, 2023

Conversation

larskanis
Copy link
Collaborator

pg_encoding_to_char() is index based and rb_enc_find() is st_table based, so they are fast. In addition move the dominant UTF-8 encoding to the very first in the encoding map, so that no loop is necessary.

This cache is only used at connection setup and when calling encoding getter/setter, so that no practical performance impact is expected.

Removing the cache makes connection setup thread safe. This is required to make ruby-pg ractor ready.

pg_encoding_to_char() is index based and rb_enc_find() is st_table based, so they are fast.
In addition move the dominant UTF-8 encoding to the very first in the encoding map, so that no loop is necessary.

This cache was only used at connection setup and when calling encoding getter/setter, so that no practical performance impact is expected.

Removing the cache makes connection setup thread safe.
This is required to make ruby-pg ractor ready.
@larskanis larskanis merged commit 6bc2028 into ged:master Mar 29, 2023
@larskanis larskanis deleted the rm-enc-cache branch March 31, 2023 12:55
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.

1 participant