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

Symbol hashes #278

Closed
ged opened this issue Jun 18, 2018 · 3 comments · Fixed by #306
Closed

Symbol hashes #278

ged opened this issue Jun 18, 2018 · 3 comments · Fixed by #306
Labels
1.0.0 Library major migrated Migrated from issues on Bitbucket and/or Rubyforge proposal

Comments

@ged
Copy link
Owner

ged commented Jun 18, 2018

Original report by Вячеслав Краснов (Bitbucket: slavestys, GitHub: slavestys).


Hello! Is there a possibility to make pg return symbol hashes because they work much faster than strings

@ged
Copy link
Owner Author

ged commented Jul 27, 2018

Original comment by Вячеслав Краснов (Bitbucket: slavestys, GitHub: slavestys).


Answer please.

@ged
Copy link
Owner Author

ged commented Jul 27, 2018

Original comment by Lars Kanis (Bitbucket: larskanis, GitHub: larskanis).


There is no support yet. I'll probably work on a flag to switch all field names to symbols. It is targeted for pg-1.2.

@ged
Copy link
Owner Author

ged commented Jul 30, 2018

Original comment by Вячеслав Краснов (Bitbucket: slavestys, GitHub: slavestys).


Thanks for the reply.

@ged ged modified the milestone: Pending Oct 8, 2019
@ged ged added the migrated Migrated from issues on Bitbucket and/or Rubyforge label Oct 8, 2019
larskanis added a commit to larskanis/ruby-pg that referenced this issue Nov 10, 2019
This adds:
* PG::Result#field_name_type=
* PG::Result#field_name_type
* PG::Result#field_names_as

Symbol comparison and lookup is faster, since the string hash is generated at Symbol creation.
So retrieval of Symbol based field names is somewhat slower, but this is easily outperformed in frameworks that do a lot of lookups.

Fixes ged#278
larskanis added a commit to larskanis/ruby-pg that referenced this issue Nov 10, 2019
This adds:
* PG::Result#field_name_type=
* PG::Result#field_name_type
* PG::Result#field_names_as

Symbol comparison and lookup is faster, since the string hash is generated at Symbol creation.
So retrieval of Symbol based field names is somewhat slower, but this is easily outperformed in frameworks that do a lot of lookups.

Fixes ged#278
larskanis added a commit to larskanis/ruby-pg that referenced this issue Nov 10, 2019
This adds:
* PG::Result#field_name_type=
* PG::Result#field_name_type
* PG::Result#field_names_as

Symbol comparison and lookup is faster, since the string hash is generated at Symbol creation.
So retrieval of Symbol based field names is somewhat slower, but this is easily outperformed in frameworks that do a lot of lookups.

This raises ruby version requirement to 2.2, since it depends on GC'able symbols.

Fixes ged#278
larskanis added a commit to larskanis/ruby-pg that referenced this issue Nov 16, 2019
This adds:
* PG::Result#field_name_type=
* PG::Result#field_name_type
* PG::Result#field_names_as

Symbol comparison and lookup is faster, since the string hash is generated at Symbol creation.
So retrieval of Symbol based field names is somewhat slower, but this is easily outperformed in frameworks that do a lot of lookups.

This raises ruby version requirement to 2.2, since it depends on GC'able symbols.

Fixes ged#278
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.0.0 Library major migrated Migrated from issues on Bitbucket and/or Rubyforge proposal
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant