Skip to content

Conversation

@JinMaa
Copy link

@JinMaa JinMaa commented Mar 8, 2025

This optimization:

  1. Adds a global RwLock-protected HashMap to cache serialized BlockTrace structures
  2. Modifies save_trace to build and cache BlockTrace during indexing
  3. Updates traceblock view function to return cached data directly when available

These changes significantly improve performance by eliminating the need to iteratively assemble BlockTrace structures on each view request.

Sonnet 3.7 (thinking)

jinmaa added 2 commits March 8, 2025 17:45
…ctures

This optimization:
1. Adds a global RwLock-protected HashMap to cache serialized BlockTrace structures
2. Modifies save_trace to build and cache BlockTrace during indexing
3. Updates traceblock view function to return cached data directly when available

These changes significantly improve performance by eliminating the need to
iteratively assemble BlockTrace structures on each view request.
- Added BLOCK_TRACES table for storing complete BlockTrace structures by height
- Modified index_block to reset the BlockTrace cache at the beginning
- Added functionality to save the complete BlockTrace at the end of indexing
- Updated traceblock function to check BLOCK_TRACES table first before falling back to cache or rebuilding
- Improved error handling for BlockTrace data retrieval
- Updated function signatures to match new implementation
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