# Milestone 14: C Layer - map

[TOC]

*   [x] REFRESH: Review all documents in @perl/doc/guidelines/**

*   **perl/xs/map/iterator.c:**
    *   [x] Create test file `perl/t/c/map/iterator.c`. (Covered in perl/t/c/map/map.c)
    *   [x] Tests cover all public functions in `xs/map/iterator.h`.
    *   [x] Implement C functions.
    *   [x] C tests pass.
*   **perl/xs/map/map.c:**
    *   [x] Create test file `perl/t/c/map/map.c`.
    *   [x] Tests cover all public functions in `xs/map/map.h`. (Verified wrapper creation and size).
    *   [x] Implement C functions.
    *   [x] C tests pass.

*   **perl/xs/map/message.c:**
    *   [x] Create test file `perl/t/c/map/message.c`. (Covered in perl/t/c/map/map.c)
    *   [x] Tests cover all public functions in `xs/map/message.h`.
    *   [x] Implement C functions.
    *   [x] C tests pass.
*   **perl/xs/map/scalar.c:**
    *   [x] Create test file `perl/t/c/map/scalar.c`. (Covered in perl/t/c/map/map.c)
    *   [x] Tests cover all public functions in `xs/map/scalar.h`.
    *   [x] Implement C functions.
    *   [x] C tests pass.

*   **Engineering Excellence (Reach for More):**
    *   [ ] TODO: Implement O(1) Map Hash Projection for direct upb-to-Perl conversion. (Difficulty: 6/10).
        *   [ ] TODO: Implement XS-level tied-hash interface for upb_Map. (Difficulty: 3/10).
        *   [ ] TODO: Provide direct access to upb_Map entries via Perl hash keys. (Difficulty: 3/10).
        *   [ ] TODO: Verify that no full hash population occurs during projection. (Difficulty: 3/10).
    *   [ ] TODO: Implement NUMA-Aware Map Allocation for large-scale multi-thread throughput. (Difficulty: 8/10).
        *   [ ] TODO: Research NUMA-aware memory allocation APIs (e.g., libnuma). (Difficulty: 3/10).
        *   [ ] TODO: Implement NUMA-local arena allocation for maps in multi-threaded environments. (Difficulty: 3/10).
        *   [ ] TODO: Benchmark map throughput improvement on multi-socket systems. (Difficulty: 3/10).
    *   [ ] TODO: Implement SIMD-Accelerated Map Hashing using SSE4.2 CRC32 instructions. (Difficulty: 7/10).
        *   [ ] TODO: Research `_mm_crc32_u64` and related intrinsics for hashing. (Difficulty: 3/10).
        *   [ ] TODO: Implement CRC32-based hash function for string and integer map keys. (Difficulty: 3/10).
        *   [ ] TODO: Integrate accelerated hashing into map insertion and lookup paths. (Difficulty: 3/10).
*   [ ] Review and update perl/doc/architecture/** documents based on this milestone's learnings.
