Skip to content

Hash table for faster key/value lookups - #632

Open
jacobwilliams wants to merge 19 commits into
masterfrom
631-hash
Open

Hash table for faster key/value lookups#632
jacobwilliams wants to merge 19 commits into
masterfrom
631-hash

Conversation

@jacobwilliams

Copy link
Copy Markdown
Owner

Fixes #631

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces an experimental hash-table implementation to speed up key/value lookups for JSON objects (Fixes #631), integrates it into the main json_module, and adds a new unit test to exercise basic functionality and compare timing against existing linked-list lookup.

Changes:

  • Add json_hash_module with a json_hash_table type supporting create/get/destroy for object-member lookup acceleration.
  • Expose JSON name-comparison settings via json_core%get_name_settings so the hash table can match JSON key-comparison behavior.
  • Add and wire up jf_test_54 (including Visual Studio project/test runner integration) and include the new module in CMake builds.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/json_hash_module.f90 New hash table implementation for faster object-member lookup.
src/json_value_module.F90 Adds json_core%get_name_settings used by the hash table for consistent key handling.
src/json_module.F90 Imports json_hash_module so consumers can access json_hash_table via use json_module.
test/jf_test_54.F90 New unit test for hash table creation/lookup and a basic performance comparison.
CMakeLists.txt Adds the new hash module source file to the library build.
visual_studio/jsonfortrantest/jsonfortrantest.f90 Adds test 54 to the Visual Studio test runner program.
visual_studio/jsonfortrantest/jsonfortrantest.vfproj Adds test 54 source file to the Visual Studio project.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/json_hash_module.f90 Outdated
Comment thread src/json_hash_module.f90 Outdated
Comment thread src/json_hash_module.f90 Outdated
Comment thread src/json_hash_module.f90 Outdated
Comment thread src/json_hash_module.f90 Outdated
@jacobwilliams jacobwilliams changed the title Draft: experiment with a hash table for faster key/value lookups Hash table for faster key/value lookups May 11, 2026
@jacobwilliams jacobwilliams mentioned this pull request May 11, 2026
formatting
minor update for error check
can now optionally enable to speed up lookups of top-level keys in a json_file, after it has been read.
required some refactoring.
added new unit test.
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.

Hash table

2 participants