Skip to content

MOD-14010 support Homogenues array floating point forcing(deserializa… - #17

Merged
AvivDavid23 merged 33 commits into
masterfrom
MOD-13577-datatypes-json-homogeneous-fp-arrays-declare-fp-type
Mar 3, 2026
Merged

MOD-14010 support Homogenues array floating point forcing(deserializa…#17
AvivDavid23 merged 33 commits into
masterfrom
MOD-13577-datatypes-json-homogeneous-fp-arrays-declare-fp-type

Conversation

@AvivDavid23

@AvivDavid23AvivDavid23 commented Feb 9, 2026

Copy link
Copy Markdown

…tion path only)

  • Add Option to try and enforce specific float type in a value for a homogenues array
  • Add binary encoding and decoding, which will be used by RedisJson(to easily preserve the tag per path)
  • Add tests, fuzz tests

no production-quality Rust CBOR library implements RFC 8746 natively (the only candidate, cbor_enhanced, has been unmaintained since 2020 and lacks F16-LE and BF16 support), so a thin IValue ↔ ciborium::Value conversion layer is still needed

Size comparison (vs JSON baseline)

DocumentJSONCBORCBOR+zstd
FP32 array (1000 elements)19 180 B4 005 B (−79%)3 593 B (−81%)
FP64 array (1000 elements)5 891 B8 005 B (+36%)2 359 B (−60%)
Heterogeneous array (1000 nums)5 891 B8 005 B (+36%)2 359 B (−60%)
String-heavy object (50 keys)2 181 B2 032 B (−7%)191 B (−91%)
Mixed object94 B59 B (−37%)68 B (−28%)
Nested FP32 arrays + string3 110 B826 B (−73%)338 B (−89%)
Big mixed JSON (200 records)77 190 B66 068 B (−14%)17 777 B (−77%)
Repeated strings / RED-14188649 276 B37 190 B (−25%)2 418 B (−95%)

Example payloads

1 — FP32 typed array (1 000 elements, stored with FPHA F32 tag)

[0.0, 0.001, 0.002, 0.003, 0.004, ...] // 1 000 floats total

2 — FP64 typed array (1 000 elements, stored with FPHA F64 tag)

[0.0, 0.001, 0.002, ...] // 1 000 doubles total

3 — Heterogeneous float array (same data, no FPHA hint)

Same JSON as above; without an FPHA hint the array is stored as ArrayHetero
(each element tagged individually). zstd still achieves the same ratio because
the repeated tag bytes compress well.

4 — String-heavy object (50 keys)

{
"key_0": "value_0_some_longer_string_here",
"key_1": "value_1_some_longer_string_here",
"key_2": "value_2_some_longer_string_here",
... // 50 keys total
}

5 — Small mixed object

{
"name": "Alice",
"age": 30,
"scores": [1, 2, 3, null, true, "bonus"],
"meta": {"active": true, "level": 42}
}

6 — Nested FP32 arrays + string

{
"a": [0.0, 0.1, 0.2, ...], // 100 F32 elements"b": [0.0, 0.1, 0.2, ...], // 100 F32 elements"label": "test"
}

7 — Big mixed JSON (200 records, heterogeneous embeddings)

[
{
"id": 0, "name": "user_0", "active": true, "score": 0.0,
"tags": ["alpha", "beta", "gamma"],
"embedding": [0.0, 0.001, 0.002, ...] // 32 floats
},
// ... 200 records total, repeated schema
]

The repeated key names ("id", "name", "active", "score", "tags", "embedding")
across 200 records are what zstd compresses so aggressively here.

8 — Repeated-string records (500 records, RED-141886 scenario)

[
{"id": 0, "status": "active", "region": "us-east-1", "tier": "free", "owner": "team-a", "count": 0},
{"id": 1, "status": "inactive", "region": "eu-west-1", "tier": "standard", "owner": "team-b", "count": 10},
// ... 500 records; status/region/tier/owner values repeat from a small fixed set
]

Note

High Risk
Adds new CBOR/zstd encoding and changes core IArray fallible APIs to return a new IJsonError, which can affect downstream callers and data interchange correctness.

Overview
Adds optional floating-point homogeneous array (FPHA) enforcement during JSON deserialization via FPHAConfig/IValueDeserSeed, plus IArray::push_with_fp_type to force F16/BF16/F32/F64 storage and reject out-of-range values.

Introduces a new cbor module with encode/decode and zstd-compressed variants that preserve typed array tags using RFC 8746 (with a private BF16 tag), and surfaces this API from lib.rs.

Refactors array-related fallible APIs to return IJsonError (wrapping allocation failures and new range errors), adds extensive unit tests, and expands CI fuzzing to cover CBOR decode + round-trip (with updated fuzz runtime/memory flags).

Written by Cursor Bugbot for commit 9675e63. This will update automatically on new commits. Configure here.

Comment threadsrc/de.rs Outdated
Comment threadsrc/de.rs Outdated
Comment threadsrc/array.rs Outdated
@AvivDavid23AvivDavid23 changed the title MOD-13577 support Homogenues array floating point forcing(deserializa…MOD-14010 support Homogenues array floating point forcing(deserializa…Feb 18, 2026
Comment threadfuzz/fuzz_targets/fuzz_binary_decode.rs Outdated
Comment threadsrc/binary.rs Outdated
Comment thread.github/actions/fuzz_tests/action.yml
@RedisJSONRedisJSON deleted a comment from cursorBotFeb 22, 2026
Comment threadsrc/cbor.rs
Comment threadsrc/cbor.rs
@galcohen-redislabs

Copy link
Copy Markdown

Did you look at c2pa_cbor?

Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/src/lib.rs Outdated
@AvivDavid23

Copy link
Copy Markdown
Author

Did you look at c2pa_cbor?

@galcohen-redislabs I can try that, although it doesnt have a major release, and very low usage:
image

Comment threadsrc/de.rs
Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/fuzz_targets/fuzz_json_de.rs Outdated
Comment threadsrc/cbor.rs
Comment threadsrc/array.rs
Comment threadsrc/array.rs
Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/src/lib.rs Outdated

@cursorcursorBot 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.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Comment threadsrc/cbor.rs
Comment threadsrc/cbor.rs
@AvivDavid23
AvivDavid23 merged commit 259d8ac into masterMar 3, 2026
5 checks passed
@GuyAv46

Copy link
Copy Markdown

What are the implications for the C API? How can we use this optimization?

@AvivDavid23

Copy link
Copy Markdown
Author

What are the implications for the C API? How can we use this optimization?
@GuyAv46
RedisJSON/RedisJSON#1521

Sign up for freeto 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.

3 participants

@AvivDavid23@galcohen-redislabs@GuyAv46
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
MOD-14010 support Homogenues array floating point forcing(deserializa… by AvivDavid23 · Pull Request #17 · RedisJSON/ijson · GitHub
Skip to content

MOD-14010 support Homogenues array floating point forcing(deserializa… - #17

Merged
AvivDavid23 merged 33 commits into
masterfrom
MOD-13577-datatypes-json-homogeneous-fp-arrays-declare-fp-type
Mar 3, 2026
Merged

MOD-14010 support Homogenues array floating point forcing(deserializa…#17
AvivDavid23 merged 33 commits into
masterfrom
MOD-13577-datatypes-json-homogeneous-fp-arrays-declare-fp-type

Conversation

@AvivDavid23

@AvivDavid23AvivDavid23 commented Feb 9, 2026

Copy link
Copy Markdown

…tion path only)

  • Add Option to try and enforce specific float type in a value for a homogenues array
  • Add binary encoding and decoding, which will be used by RedisJson(to easily preserve the tag per path)
  • Add tests, fuzz tests

no production-quality Rust CBOR library implements RFC 8746 natively (the only candidate, cbor_enhanced, has been unmaintained since 2020 and lacks F16-LE and BF16 support), so a thin IValue ↔ ciborium::Value conversion layer is still needed

Size comparison (vs JSON baseline)

DocumentJSONCBORCBOR+zstd
FP32 array (1000 elements)19 180 B4 005 B (−79%)3 593 B (−81%)
FP64 array (1000 elements)5 891 B8 005 B (+36%)2 359 B (−60%)
Heterogeneous array (1000 nums)5 891 B8 005 B (+36%)2 359 B (−60%)
String-heavy object (50 keys)2 181 B2 032 B (−7%)191 B (−91%)
Mixed object94 B59 B (−37%)68 B (−28%)
Nested FP32 arrays + string3 110 B826 B (−73%)338 B (−89%)
Big mixed JSON (200 records)77 190 B66 068 B (−14%)17 777 B (−77%)
Repeated strings / RED-14188649 276 B37 190 B (−25%)2 418 B (−95%)

Example payloads

1 — FP32 typed array (1 000 elements, stored with FPHA F32 tag)

[0.0, 0.001, 0.002, 0.003, 0.004, ...] // 1 000 floats total

2 — FP64 typed array (1 000 elements, stored with FPHA F64 tag)

[0.0, 0.001, 0.002, ...] // 1 000 doubles total

3 — Heterogeneous float array (same data, no FPHA hint)

Same JSON as above; without an FPHA hint the array is stored as ArrayHetero
(each element tagged individually). zstd still achieves the same ratio because
the repeated tag bytes compress well.

4 — String-heavy object (50 keys)

{
"key_0": "value_0_some_longer_string_here",
"key_1": "value_1_some_longer_string_here",
"key_2": "value_2_some_longer_string_here",
... // 50 keys total
}

5 — Small mixed object

{
"name": "Alice",
"age": 30,
"scores": [1, 2, 3, null, true, "bonus"],
"meta": {"active": true, "level": 42}
}

6 — Nested FP32 arrays + string

{
"a": [0.0, 0.1, 0.2, ...], // 100 F32 elements"b": [0.0, 0.1, 0.2, ...], // 100 F32 elements"label": "test"
}

7 — Big mixed JSON (200 records, heterogeneous embeddings)

[
{
"id": 0, "name": "user_0", "active": true, "score": 0.0,
"tags": ["alpha", "beta", "gamma"],
"embedding": [0.0, 0.001, 0.002, ...] // 32 floats
},
// ... 200 records total, repeated schema
]

The repeated key names ("id", "name", "active", "score", "tags", "embedding")
across 200 records are what zstd compresses so aggressively here.

8 — Repeated-string records (500 records, RED-141886 scenario)

[
{"id": 0, "status": "active", "region": "us-east-1", "tier": "free", "owner": "team-a", "count": 0},
{"id": 1, "status": "inactive", "region": "eu-west-1", "tier": "standard", "owner": "team-b", "count": 10},
// ... 500 records; status/region/tier/owner values repeat from a small fixed set
]

Note

High Risk
Adds new CBOR/zstd encoding and changes core IArray fallible APIs to return a new IJsonError, which can affect downstream callers and data interchange correctness.

Overview
Adds optional floating-point homogeneous array (FPHA) enforcement during JSON deserialization via FPHAConfig/IValueDeserSeed, plus IArray::push_with_fp_type to force F16/BF16/F32/F64 storage and reject out-of-range values.

Introduces a new cbor module with encode/decode and zstd-compressed variants that preserve typed array tags using RFC 8746 (with a private BF16 tag), and surfaces this API from lib.rs.

Refactors array-related fallible APIs to return IJsonError (wrapping allocation failures and new range errors), adds extensive unit tests, and expands CI fuzzing to cover CBOR decode + round-trip (with updated fuzz runtime/memory flags).

Written by Cursor Bugbot for commit 9675e63. This will update automatically on new commits. Configure here.

Comment threadsrc/de.rs Outdated
Comment threadsrc/de.rs Outdated
Comment threadsrc/array.rs Outdated
@AvivDavid23AvivDavid23 changed the title MOD-13577 support Homogenues array floating point forcing(deserializa…MOD-14010 support Homogenues array floating point forcing(deserializa…Feb 18, 2026
Comment threadfuzz/fuzz_targets/fuzz_binary_decode.rs Outdated
Comment threadsrc/binary.rs Outdated
Comment thread.github/actions/fuzz_tests/action.yml
@RedisJSONRedisJSON deleted a comment from cursorBotFeb 22, 2026
Comment threadsrc/cbor.rs
Comment threadsrc/cbor.rs
@galcohen-redislabs

Copy link
Copy Markdown

Did you look at c2pa_cbor?

Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/src/lib.rs Outdated
@AvivDavid23

Copy link
Copy Markdown
Author

Did you look at c2pa_cbor?

@galcohen-redislabs I can try that, although it doesnt have a major release, and very low usage:
image

Comment threadsrc/de.rs
Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/fuzz_targets/fuzz_json_de.rs Outdated
Comment threadsrc/cbor.rs
Comment threadsrc/array.rs
Comment threadsrc/array.rs
Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/src/lib.rs Outdated

@cursorcursorBot 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.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Comment threadsrc/cbor.rs
Comment threadsrc/cbor.rs
@AvivDavid23
AvivDavid23 merged commit 259d8ac into masterMar 3, 2026
5 checks passed
@GuyAv46

Copy link
Copy Markdown

What are the implications for the C API? How can we use this optimization?

@AvivDavid23

Copy link
Copy Markdown
Author

What are the implications for the C API? How can we use this optimization?
@GuyAv46
RedisJSON/RedisJSON#1521

Sign up for freeto 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.

3 participants

@AvivDavid23@galcohen-redislabs@GuyAv46
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' MOD-14010 support Homogenues array floating point forcing(deserializa… by AvivDavid23 · Pull Request #17 · RedisJSON/ijson · GitHub
Skip to content

MOD-14010 support Homogenues array floating point forcing(deserializa… - #17

Merged
AvivDavid23 merged 33 commits into
masterfrom
MOD-13577-datatypes-json-homogeneous-fp-arrays-declare-fp-type
Mar 3, 2026
Merged

MOD-14010 support Homogenues array floating point forcing(deserializa…#17
AvivDavid23 merged 33 commits into
masterfrom
MOD-13577-datatypes-json-homogeneous-fp-arrays-declare-fp-type

Conversation

@AvivDavid23

@AvivDavid23AvivDavid23 commented Feb 9, 2026

Copy link
Copy Markdown

…tion path only)

  • Add Option to try and enforce specific float type in a value for a homogenues array
  • Add binary encoding and decoding, which will be used by RedisJson(to easily preserve the tag per path)
  • Add tests, fuzz tests

no production-quality Rust CBOR library implements RFC 8746 natively (the only candidate, cbor_enhanced, has been unmaintained since 2020 and lacks F16-LE and BF16 support), so a thin IValue ↔ ciborium::Value conversion layer is still needed

Size comparison (vs JSON baseline)

DocumentJSONCBORCBOR+zstd
FP32 array (1000 elements)19 180 B4 005 B (−79%)3 593 B (−81%)
FP64 array (1000 elements)5 891 B8 005 B (+36%)2 359 B (−60%)
Heterogeneous array (1000 nums)5 891 B8 005 B (+36%)2 359 B (−60%)
String-heavy object (50 keys)2 181 B2 032 B (−7%)191 B (−91%)
Mixed object94 B59 B (−37%)68 B (−28%)
Nested FP32 arrays + string3 110 B826 B (−73%)338 B (−89%)
Big mixed JSON (200 records)77 190 B66 068 B (−14%)17 777 B (−77%)
Repeated strings / RED-14188649 276 B37 190 B (−25%)2 418 B (−95%)

Example payloads

1 — FP32 typed array (1 000 elements, stored with FPHA F32 tag)

[0.0, 0.001, 0.002, 0.003, 0.004, ...] // 1 000 floats total

2 — FP64 typed array (1 000 elements, stored with FPHA F64 tag)

[0.0, 0.001, 0.002, ...] // 1 000 doubles total

3 — Heterogeneous float array (same data, no FPHA hint)

Same JSON as above; without an FPHA hint the array is stored as ArrayHetero
(each element tagged individually). zstd still achieves the same ratio because
the repeated tag bytes compress well.

4 — String-heavy object (50 keys)

{
"key_0": "value_0_some_longer_string_here",
"key_1": "value_1_some_longer_string_here",
"key_2": "value_2_some_longer_string_here",
... // 50 keys total
}

5 — Small mixed object

{
"name": "Alice",
"age": 30,
"scores": [1, 2, 3, null, true, "bonus"],
"meta": {"active": true, "level": 42}
}

6 — Nested FP32 arrays + string

{
"a": [0.0, 0.1, 0.2, ...], // 100 F32 elements"b": [0.0, 0.1, 0.2, ...], // 100 F32 elements"label": "test"
}

7 — Big mixed JSON (200 records, heterogeneous embeddings)

[
{
"id": 0, "name": "user_0", "active": true, "score": 0.0,
"tags": ["alpha", "beta", "gamma"],
"embedding": [0.0, 0.001, 0.002, ...] // 32 floats
},
// ... 200 records total, repeated schema
]

The repeated key names ("id", "name", "active", "score", "tags", "embedding")
across 200 records are what zstd compresses so aggressively here.

8 — Repeated-string records (500 records, RED-141886 scenario)

[
{"id": 0, "status": "active", "region": "us-east-1", "tier": "free", "owner": "team-a", "count": 0},
{"id": 1, "status": "inactive", "region": "eu-west-1", "tier": "standard", "owner": "team-b", "count": 10},
// ... 500 records; status/region/tier/owner values repeat from a small fixed set
]

Note

High Risk
Adds new CBOR/zstd encoding and changes core IArray fallible APIs to return a new IJsonError, which can affect downstream callers and data interchange correctness.

Overview
Adds optional floating-point homogeneous array (FPHA) enforcement during JSON deserialization via FPHAConfig/IValueDeserSeed, plus IArray::push_with_fp_type to force F16/BF16/F32/F64 storage and reject out-of-range values.

Introduces a new cbor module with encode/decode and zstd-compressed variants that preserve typed array tags using RFC 8746 (with a private BF16 tag), and surfaces this API from lib.rs.

Refactors array-related fallible APIs to return IJsonError (wrapping allocation failures and new range errors), adds extensive unit tests, and expands CI fuzzing to cover CBOR decode + round-trip (with updated fuzz runtime/memory flags).

Written by Cursor Bugbot for commit 9675e63. This will update automatically on new commits. Configure here.

Comment threadsrc/de.rs Outdated
Comment threadsrc/de.rs Outdated
Comment threadsrc/array.rs Outdated
@AvivDavid23AvivDavid23 changed the title MOD-13577 support Homogenues array floating point forcing(deserializa…MOD-14010 support Homogenues array floating point forcing(deserializa…Feb 18, 2026
Comment threadfuzz/fuzz_targets/fuzz_binary_decode.rs Outdated
Comment threadsrc/binary.rs Outdated
Comment thread.github/actions/fuzz_tests/action.yml
@RedisJSONRedisJSON deleted a comment from cursorBotFeb 22, 2026
Comment threadsrc/cbor.rs
Comment threadsrc/cbor.rs
@galcohen-redislabs

Copy link
Copy Markdown

Did you look at c2pa_cbor?

Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/src/lib.rs Outdated
@AvivDavid23

Copy link
Copy Markdown
Author

Did you look at c2pa_cbor?

@galcohen-redislabs I can try that, although it doesnt have a major release, and very low usage:
image

Comment threadsrc/de.rs
Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/fuzz_targets/fuzz_json_de.rs Outdated
Comment threadsrc/cbor.rs
Comment threadsrc/array.rs
Comment threadsrc/array.rs
Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/src/lib.rs Outdated

@cursorcursorBot 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.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Comment threadsrc/cbor.rs
Comment threadsrc/cbor.rs
@AvivDavid23
AvivDavid23 merged commit 259d8ac into masterMar 3, 2026
5 checks passed
@GuyAv46

Copy link
Copy Markdown

What are the implications for the C API? How can we use this optimization?

@AvivDavid23

Copy link
Copy Markdown
Author

What are the implications for the C API? How can we use this optimization?
@GuyAv46
RedisJSON/RedisJSON#1521

Sign up for freeto 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.

3 participants

@AvivDavid23@galcohen-redislabs@GuyAv46
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' MOD-14010 support Homogenues array floating point forcing(deserializa… by AvivDavid23 · Pull Request #17 · RedisJSON/ijson · GitHub
Skip to content

MOD-14010 support Homogenues array floating point forcing(deserializa… - #17

Merged
AvivDavid23 merged 33 commits into
masterfrom
MOD-13577-datatypes-json-homogeneous-fp-arrays-declare-fp-type
Mar 3, 2026
Merged

MOD-14010 support Homogenues array floating point forcing(deserializa…#17
AvivDavid23 merged 33 commits into
masterfrom
MOD-13577-datatypes-json-homogeneous-fp-arrays-declare-fp-type

Conversation

@AvivDavid23

@AvivDavid23AvivDavid23 commented Feb 9, 2026

Copy link
Copy Markdown

…tion path only)

  • Add Option to try and enforce specific float type in a value for a homogenues array
  • Add binary encoding and decoding, which will be used by RedisJson(to easily preserve the tag per path)
  • Add tests, fuzz tests

no production-quality Rust CBOR library implements RFC 8746 natively (the only candidate, cbor_enhanced, has been unmaintained since 2020 and lacks F16-LE and BF16 support), so a thin IValue ↔ ciborium::Value conversion layer is still needed

Size comparison (vs JSON baseline)

DocumentJSONCBORCBOR+zstd
FP32 array (1000 elements)19 180 B4 005 B (−79%)3 593 B (−81%)
FP64 array (1000 elements)5 891 B8 005 B (+36%)2 359 B (−60%)
Heterogeneous array (1000 nums)5 891 B8 005 B (+36%)2 359 B (−60%)
String-heavy object (50 keys)2 181 B2 032 B (−7%)191 B (−91%)
Mixed object94 B59 B (−37%)68 B (−28%)
Nested FP32 arrays + string3 110 B826 B (−73%)338 B (−89%)
Big mixed JSON (200 records)77 190 B66 068 B (−14%)17 777 B (−77%)
Repeated strings / RED-14188649 276 B37 190 B (−25%)2 418 B (−95%)

Example payloads

1 — FP32 typed array (1 000 elements, stored with FPHA F32 tag)

[0.0, 0.001, 0.002, 0.003, 0.004, ...] // 1 000 floats total

2 — FP64 typed array (1 000 elements, stored with FPHA F64 tag)

[0.0, 0.001, 0.002, ...] // 1 000 doubles total

3 — Heterogeneous float array (same data, no FPHA hint)

Same JSON as above; without an FPHA hint the array is stored as ArrayHetero
(each element tagged individually). zstd still achieves the same ratio because
the repeated tag bytes compress well.

4 — String-heavy object (50 keys)

{
"key_0": "value_0_some_longer_string_here",
"key_1": "value_1_some_longer_string_here",
"key_2": "value_2_some_longer_string_here",
... // 50 keys total
}

5 — Small mixed object

{
"name": "Alice",
"age": 30,
"scores": [1, 2, 3, null, true, "bonus"],
"meta": {"active": true, "level": 42}
}

6 — Nested FP32 arrays + string

{
"a": [0.0, 0.1, 0.2, ...], // 100 F32 elements"b": [0.0, 0.1, 0.2, ...], // 100 F32 elements"label": "test"
}

7 — Big mixed JSON (200 records, heterogeneous embeddings)

[
{
"id": 0, "name": "user_0", "active": true, "score": 0.0,
"tags": ["alpha", "beta", "gamma"],
"embedding": [0.0, 0.001, 0.002, ...] // 32 floats
},
// ... 200 records total, repeated schema
]

The repeated key names ("id", "name", "active", "score", "tags", "embedding")
across 200 records are what zstd compresses so aggressively here.

8 — Repeated-string records (500 records, RED-141886 scenario)

[
{"id": 0, "status": "active", "region": "us-east-1", "tier": "free", "owner": "team-a", "count": 0},
{"id": 1, "status": "inactive", "region": "eu-west-1", "tier": "standard", "owner": "team-b", "count": 10},
// ... 500 records; status/region/tier/owner values repeat from a small fixed set
]

Note

High Risk
Adds new CBOR/zstd encoding and changes core IArray fallible APIs to return a new IJsonError, which can affect downstream callers and data interchange correctness.

Overview
Adds optional floating-point homogeneous array (FPHA) enforcement during JSON deserialization via FPHAConfig/IValueDeserSeed, plus IArray::push_with_fp_type to force F16/BF16/F32/F64 storage and reject out-of-range values.

Introduces a new cbor module with encode/decode and zstd-compressed variants that preserve typed array tags using RFC 8746 (with a private BF16 tag), and surfaces this API from lib.rs.

Refactors array-related fallible APIs to return IJsonError (wrapping allocation failures and new range errors), adds extensive unit tests, and expands CI fuzzing to cover CBOR decode + round-trip (with updated fuzz runtime/memory flags).

Written by Cursor Bugbot for commit 9675e63. This will update automatically on new commits. Configure here.

Comment threadsrc/de.rs Outdated
Comment threadsrc/de.rs Outdated
Comment threadsrc/array.rs Outdated
@AvivDavid23AvivDavid23 changed the title MOD-13577 support Homogenues array floating point forcing(deserializa…MOD-14010 support Homogenues array floating point forcing(deserializa…Feb 18, 2026
Comment threadfuzz/fuzz_targets/fuzz_binary_decode.rs Outdated
Comment threadsrc/binary.rs Outdated
Comment thread.github/actions/fuzz_tests/action.yml
@RedisJSONRedisJSON deleted a comment from cursorBotFeb 22, 2026
Comment threadsrc/cbor.rs
Comment threadsrc/cbor.rs
@galcohen-redislabs

Copy link
Copy Markdown

Did you look at c2pa_cbor?

Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/src/lib.rs Outdated
@AvivDavid23

Copy link
Copy Markdown
Author

Did you look at c2pa_cbor?

@galcohen-redislabs I can try that, although it doesnt have a major release, and very low usage:
image

Comment threadsrc/de.rs
Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/fuzz_targets/fuzz_json_de.rs Outdated
Comment threadsrc/cbor.rs
Comment threadsrc/array.rs
Comment threadsrc/array.rs
Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/src/lib.rs Outdated

@cursorcursorBot 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.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Comment threadsrc/cbor.rs
Comment threadsrc/cbor.rs
@AvivDavid23
AvivDavid23 merged commit 259d8ac into masterMar 3, 2026
5 checks passed
@GuyAv46

Copy link
Copy Markdown

What are the implications for the C API? How can we use this optimization?

@AvivDavid23

Copy link
Copy Markdown
Author

What are the implications for the C API? How can we use this optimization?
@GuyAv46
RedisJSON/RedisJSON#1521

Sign up for freeto 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.

3 participants

@AvivDavid23@galcohen-redislabs@GuyAv46
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' MOD-14010 support Homogenues array floating point forcing(deserializa… by AvivDavid23 · Pull Request #17 · RedisJSON/ijson · GitHub
Skip to content

MOD-14010 support Homogenues array floating point forcing(deserializa… - #17

Merged
AvivDavid23 merged 33 commits into
masterfrom
MOD-13577-datatypes-json-homogeneous-fp-arrays-declare-fp-type
Mar 3, 2026
Merged

MOD-14010 support Homogenues array floating point forcing(deserializa…#17
AvivDavid23 merged 33 commits into
masterfrom
MOD-13577-datatypes-json-homogeneous-fp-arrays-declare-fp-type

Conversation

@AvivDavid23

@AvivDavid23AvivDavid23 commented Feb 9, 2026

Copy link
Copy Markdown

…tion path only)

  • Add Option to try and enforce specific float type in a value for a homogenues array
  • Add binary encoding and decoding, which will be used by RedisJson(to easily preserve the tag per path)
  • Add tests, fuzz tests

no production-quality Rust CBOR library implements RFC 8746 natively (the only candidate, cbor_enhanced, has been unmaintained since 2020 and lacks F16-LE and BF16 support), so a thin IValue ↔ ciborium::Value conversion layer is still needed

Size comparison (vs JSON baseline)

DocumentJSONCBORCBOR+zstd
FP32 array (1000 elements)19 180 B4 005 B (−79%)3 593 B (−81%)
FP64 array (1000 elements)5 891 B8 005 B (+36%)2 359 B (−60%)
Heterogeneous array (1000 nums)5 891 B8 005 B (+36%)2 359 B (−60%)
String-heavy object (50 keys)2 181 B2 032 B (−7%)191 B (−91%)
Mixed object94 B59 B (−37%)68 B (−28%)
Nested FP32 arrays + string3 110 B826 B (−73%)338 B (−89%)
Big mixed JSON (200 records)77 190 B66 068 B (−14%)17 777 B (−77%)
Repeated strings / RED-14188649 276 B37 190 B (−25%)2 418 B (−95%)

Example payloads

1 — FP32 typed array (1 000 elements, stored with FPHA F32 tag)

[0.0, 0.001, 0.002, 0.003, 0.004, ...] // 1 000 floats total

2 — FP64 typed array (1 000 elements, stored with FPHA F64 tag)

[0.0, 0.001, 0.002, ...] // 1 000 doubles total

3 — Heterogeneous float array (same data, no FPHA hint)

Same JSON as above; without an FPHA hint the array is stored as ArrayHetero
(each element tagged individually). zstd still achieves the same ratio because
the repeated tag bytes compress well.

4 — String-heavy object (50 keys)

{
"key_0": "value_0_some_longer_string_here",
"key_1": "value_1_some_longer_string_here",
"key_2": "value_2_some_longer_string_here",
... // 50 keys total
}

5 — Small mixed object

{
"name": "Alice",
"age": 30,
"scores": [1, 2, 3, null, true, "bonus"],
"meta": {"active": true, "level": 42}
}

6 — Nested FP32 arrays + string

{
"a": [0.0, 0.1, 0.2, ...], // 100 F32 elements"b": [0.0, 0.1, 0.2, ...], // 100 F32 elements"label": "test"
}

7 — Big mixed JSON (200 records, heterogeneous embeddings)

[
{
"id": 0, "name": "user_0", "active": true, "score": 0.0,
"tags": ["alpha", "beta", "gamma"],
"embedding": [0.0, 0.001, 0.002, ...] // 32 floats
},
// ... 200 records total, repeated schema
]

The repeated key names ("id", "name", "active", "score", "tags", "embedding")
across 200 records are what zstd compresses so aggressively here.

8 — Repeated-string records (500 records, RED-141886 scenario)

[
{"id": 0, "status": "active", "region": "us-east-1", "tier": "free", "owner": "team-a", "count": 0},
{"id": 1, "status": "inactive", "region": "eu-west-1", "tier": "standard", "owner": "team-b", "count": 10},
// ... 500 records; status/region/tier/owner values repeat from a small fixed set
]

Note

High Risk
Adds new CBOR/zstd encoding and changes core IArray fallible APIs to return a new IJsonError, which can affect downstream callers and data interchange correctness.

Overview
Adds optional floating-point homogeneous array (FPHA) enforcement during JSON deserialization via FPHAConfig/IValueDeserSeed, plus IArray::push_with_fp_type to force F16/BF16/F32/F64 storage and reject out-of-range values.

Introduces a new cbor module with encode/decode and zstd-compressed variants that preserve typed array tags using RFC 8746 (with a private BF16 tag), and surfaces this API from lib.rs.

Refactors array-related fallible APIs to return IJsonError (wrapping allocation failures and new range errors), adds extensive unit tests, and expands CI fuzzing to cover CBOR decode + round-trip (with updated fuzz runtime/memory flags).

Written by Cursor Bugbot for commit 9675e63. This will update automatically on new commits. Configure here.

Comment threadsrc/de.rs Outdated
Comment threadsrc/de.rs Outdated
Comment threadsrc/array.rs Outdated
@AvivDavid23AvivDavid23 changed the title MOD-13577 support Homogenues array floating point forcing(deserializa…MOD-14010 support Homogenues array floating point forcing(deserializa…Feb 18, 2026
Comment threadfuzz/fuzz_targets/fuzz_binary_decode.rs Outdated
Comment threadsrc/binary.rs Outdated
Comment thread.github/actions/fuzz_tests/action.yml
@RedisJSONRedisJSON deleted a comment from cursorBotFeb 22, 2026
Comment threadsrc/cbor.rs
Comment threadsrc/cbor.rs
@galcohen-redislabs

Copy link
Copy Markdown

Did you look at c2pa_cbor?

Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/src/lib.rs Outdated
@AvivDavid23

Copy link
Copy Markdown
Author

Did you look at c2pa_cbor?

@galcohen-redislabs I can try that, although it doesnt have a major release, and very low usage:
image

Comment threadsrc/de.rs
Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/fuzz_targets/fuzz_json_de.rs Outdated
Comment threadsrc/cbor.rs
Comment threadsrc/array.rs
Comment threadsrc/array.rs
Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/src/lib.rs Outdated

@cursorcursorBot 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.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Comment threadsrc/cbor.rs
Comment threadsrc/cbor.rs
@AvivDavid23
AvivDavid23 merged commit 259d8ac into masterMar 3, 2026
5 checks passed
@GuyAv46

Copy link
Copy Markdown

What are the implications for the C API? How can we use this optimization?

@AvivDavid23

Copy link
Copy Markdown
Author

What are the implications for the C API? How can we use this optimization?
@GuyAv46
RedisJSON/RedisJSON#1521

Sign up for freeto 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.

3 participants

@AvivDavid23@galcohen-redislabs@GuyAv46
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' MOD-14010 support Homogenues array floating point forcing(deserializa… by AvivDavid23 · Pull Request #17 · RedisJSON/ijson · GitHub
Skip to content

MOD-14010 support Homogenues array floating point forcing(deserializa… - #17

Merged
AvivDavid23 merged 33 commits into
masterfrom
MOD-13577-datatypes-json-homogeneous-fp-arrays-declare-fp-type
Mar 3, 2026
Merged

MOD-14010 support Homogenues array floating point forcing(deserializa…#17
AvivDavid23 merged 33 commits into
masterfrom
MOD-13577-datatypes-json-homogeneous-fp-arrays-declare-fp-type

Conversation

@AvivDavid23

@AvivDavid23AvivDavid23 commented Feb 9, 2026

Copy link
Copy Markdown

…tion path only)

  • Add Option to try and enforce specific float type in a value for a homogenues array
  • Add binary encoding and decoding, which will be used by RedisJson(to easily preserve the tag per path)
  • Add tests, fuzz tests

no production-quality Rust CBOR library implements RFC 8746 natively (the only candidate, cbor_enhanced, has been unmaintained since 2020 and lacks F16-LE and BF16 support), so a thin IValue ↔ ciborium::Value conversion layer is still needed

Size comparison (vs JSON baseline)

DocumentJSONCBORCBOR+zstd
FP32 array (1000 elements)19 180 B4 005 B (−79%)3 593 B (−81%)
FP64 array (1000 elements)5 891 B8 005 B (+36%)2 359 B (−60%)
Heterogeneous array (1000 nums)5 891 B8 005 B (+36%)2 359 B (−60%)
String-heavy object (50 keys)2 181 B2 032 B (−7%)191 B (−91%)
Mixed object94 B59 B (−37%)68 B (−28%)
Nested FP32 arrays + string3 110 B826 B (−73%)338 B (−89%)
Big mixed JSON (200 records)77 190 B66 068 B (−14%)17 777 B (−77%)
Repeated strings / RED-14188649 276 B37 190 B (−25%)2 418 B (−95%)

Example payloads

1 — FP32 typed array (1 000 elements, stored with FPHA F32 tag)

[0.0, 0.001, 0.002, 0.003, 0.004, ...] // 1 000 floats total

2 — FP64 typed array (1 000 elements, stored with FPHA F64 tag)

[0.0, 0.001, 0.002, ...] // 1 000 doubles total

3 — Heterogeneous float array (same data, no FPHA hint)

Same JSON as above; without an FPHA hint the array is stored as ArrayHetero
(each element tagged individually). zstd still achieves the same ratio because
the repeated tag bytes compress well.

4 — String-heavy object (50 keys)

{
"key_0": "value_0_some_longer_string_here",
"key_1": "value_1_some_longer_string_here",
"key_2": "value_2_some_longer_string_here",
... // 50 keys total
}

5 — Small mixed object

{
"name": "Alice",
"age": 30,
"scores": [1, 2, 3, null, true, "bonus"],
"meta": {"active": true, "level": 42}
}

6 — Nested FP32 arrays + string

{
"a": [0.0, 0.1, 0.2, ...], // 100 F32 elements"b": [0.0, 0.1, 0.2, ...], // 100 F32 elements"label": "test"
}

7 — Big mixed JSON (200 records, heterogeneous embeddings)

[
{
"id": 0, "name": "user_0", "active": true, "score": 0.0,
"tags": ["alpha", "beta", "gamma"],
"embedding": [0.0, 0.001, 0.002, ...] // 32 floats
},
// ... 200 records total, repeated schema
]

The repeated key names ("id", "name", "active", "score", "tags", "embedding")
across 200 records are what zstd compresses so aggressively here.

8 — Repeated-string records (500 records, RED-141886 scenario)

[
{"id": 0, "status": "active", "region": "us-east-1", "tier": "free", "owner": "team-a", "count": 0},
{"id": 1, "status": "inactive", "region": "eu-west-1", "tier": "standard", "owner": "team-b", "count": 10},
// ... 500 records; status/region/tier/owner values repeat from a small fixed set
]

Note

High Risk
Adds new CBOR/zstd encoding and changes core IArray fallible APIs to return a new IJsonError, which can affect downstream callers and data interchange correctness.

Overview
Adds optional floating-point homogeneous array (FPHA) enforcement during JSON deserialization via FPHAConfig/IValueDeserSeed, plus IArray::push_with_fp_type to force F16/BF16/F32/F64 storage and reject out-of-range values.

Introduces a new cbor module with encode/decode and zstd-compressed variants that preserve typed array tags using RFC 8746 (with a private BF16 tag), and surfaces this API from lib.rs.

Refactors array-related fallible APIs to return IJsonError (wrapping allocation failures and new range errors), adds extensive unit tests, and expands CI fuzzing to cover CBOR decode + round-trip (with updated fuzz runtime/memory flags).

Written by Cursor Bugbot for commit 9675e63. This will update automatically on new commits. Configure here.

Comment threadsrc/de.rs Outdated
Comment threadsrc/de.rs Outdated
Comment threadsrc/array.rs Outdated
@AvivDavid23AvivDavid23 changed the title MOD-13577 support Homogenues array floating point forcing(deserializa…MOD-14010 support Homogenues array floating point forcing(deserializa…Feb 18, 2026
Comment threadfuzz/fuzz_targets/fuzz_binary_decode.rs Outdated
Comment threadsrc/binary.rs Outdated
Comment thread.github/actions/fuzz_tests/action.yml
@RedisJSONRedisJSON deleted a comment from cursorBotFeb 22, 2026
Comment threadsrc/cbor.rs
Comment threadsrc/cbor.rs
@galcohen-redislabs

Copy link
Copy Markdown

Did you look at c2pa_cbor?

Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/src/lib.rs Outdated
@AvivDavid23

Copy link
Copy Markdown
Author

Did you look at c2pa_cbor?

@galcohen-redislabs I can try that, although it doesnt have a major release, and very low usage:
image

Comment threadsrc/de.rs
Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/fuzz_targets/fuzz_json_de.rs Outdated
Comment threadsrc/cbor.rs
Comment threadsrc/array.rs
Comment threadsrc/array.rs
Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/src/lib.rs Outdated

@cursorcursorBot 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.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Comment threadsrc/cbor.rs
Comment threadsrc/cbor.rs
@AvivDavid23
AvivDavid23 merged commit 259d8ac into masterMar 3, 2026
5 checks passed
@GuyAv46

Copy link
Copy Markdown

What are the implications for the C API? How can we use this optimization?

@AvivDavid23

Copy link
Copy Markdown
Author

What are the implications for the C API? How can we use this optimization?
@GuyAv46
RedisJSON/RedisJSON#1521

Sign up for freeto 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.

3 participants

@AvivDavid23@galcohen-redislabs@GuyAv46
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); MOD-14010 support Homogenues array floating point forcing(deserializa… by AvivDavid23 · Pull Request #17 · RedisJSON/ijson · GitHub
Skip to content

MOD-14010 support Homogenues array floating point forcing(deserializa… - #17

Merged
AvivDavid23 merged 33 commits into
masterfrom
MOD-13577-datatypes-json-homogeneous-fp-arrays-declare-fp-type
Mar 3, 2026
Merged

MOD-14010 support Homogenues array floating point forcing(deserializa…#17
AvivDavid23 merged 33 commits into
masterfrom
MOD-13577-datatypes-json-homogeneous-fp-arrays-declare-fp-type

Conversation

@AvivDavid23

@AvivDavid23AvivDavid23 commented Feb 9, 2026

Copy link
Copy Markdown

…tion path only)

  • Add Option to try and enforce specific float type in a value for a homogenues array
  • Add binary encoding and decoding, which will be used by RedisJson(to easily preserve the tag per path)
  • Add tests, fuzz tests

no production-quality Rust CBOR library implements RFC 8746 natively (the only candidate, cbor_enhanced, has been unmaintained since 2020 and lacks F16-LE and BF16 support), so a thin IValue ↔ ciborium::Value conversion layer is still needed

Size comparison (vs JSON baseline)

DocumentJSONCBORCBOR+zstd
FP32 array (1000 elements)19 180 B4 005 B (−79%)3 593 B (−81%)
FP64 array (1000 elements)5 891 B8 005 B (+36%)2 359 B (−60%)
Heterogeneous array (1000 nums)5 891 B8 005 B (+36%)2 359 B (−60%)
String-heavy object (50 keys)2 181 B2 032 B (−7%)191 B (−91%)
Mixed object94 B59 B (−37%)68 B (−28%)
Nested FP32 arrays + string3 110 B826 B (−73%)338 B (−89%)
Big mixed JSON (200 records)77 190 B66 068 B (−14%)17 777 B (−77%)
Repeated strings / RED-14188649 276 B37 190 B (−25%)2 418 B (−95%)

Example payloads

1 — FP32 typed array (1 000 elements, stored with FPHA F32 tag)

[0.0, 0.001, 0.002, 0.003, 0.004, ...] // 1 000 floats total

2 — FP64 typed array (1 000 elements, stored with FPHA F64 tag)

[0.0, 0.001, 0.002, ...] // 1 000 doubles total

3 — Heterogeneous float array (same data, no FPHA hint)

Same JSON as above; without an FPHA hint the array is stored as ArrayHetero
(each element tagged individually). zstd still achieves the same ratio because
the repeated tag bytes compress well.

4 — String-heavy object (50 keys)

{
"key_0": "value_0_some_longer_string_here",
"key_1": "value_1_some_longer_string_here",
"key_2": "value_2_some_longer_string_here",
... // 50 keys total
}

5 — Small mixed object

{
"name": "Alice",
"age": 30,
"scores": [1, 2, 3, null, true, "bonus"],
"meta": {"active": true, "level": 42}
}

6 — Nested FP32 arrays + string

{
"a": [0.0, 0.1, 0.2, ...], // 100 F32 elements"b": [0.0, 0.1, 0.2, ...], // 100 F32 elements"label": "test"
}

7 — Big mixed JSON (200 records, heterogeneous embeddings)

[
{
"id": 0, "name": "user_0", "active": true, "score": 0.0,
"tags": ["alpha", "beta", "gamma"],
"embedding": [0.0, 0.001, 0.002, ...] // 32 floats
},
// ... 200 records total, repeated schema
]

The repeated key names ("id", "name", "active", "score", "tags", "embedding")
across 200 records are what zstd compresses so aggressively here.

8 — Repeated-string records (500 records, RED-141886 scenario)

[
{"id": 0, "status": "active", "region": "us-east-1", "tier": "free", "owner": "team-a", "count": 0},
{"id": 1, "status": "inactive", "region": "eu-west-1", "tier": "standard", "owner": "team-b", "count": 10},
// ... 500 records; status/region/tier/owner values repeat from a small fixed set
]

Note

High Risk
Adds new CBOR/zstd encoding and changes core IArray fallible APIs to return a new IJsonError, which can affect downstream callers and data interchange correctness.

Overview
Adds optional floating-point homogeneous array (FPHA) enforcement during JSON deserialization via FPHAConfig/IValueDeserSeed, plus IArray::push_with_fp_type to force F16/BF16/F32/F64 storage and reject out-of-range values.

Introduces a new cbor module with encode/decode and zstd-compressed variants that preserve typed array tags using RFC 8746 (with a private BF16 tag), and surfaces this API from lib.rs.

Refactors array-related fallible APIs to return IJsonError (wrapping allocation failures and new range errors), adds extensive unit tests, and expands CI fuzzing to cover CBOR decode + round-trip (with updated fuzz runtime/memory flags).

Written by Cursor Bugbot for commit 9675e63. This will update automatically on new commits. Configure here.

Comment threadsrc/de.rs Outdated
Comment threadsrc/de.rs Outdated
Comment threadsrc/array.rs Outdated
@AvivDavid23AvivDavid23 changed the title MOD-13577 support Homogenues array floating point forcing(deserializa…MOD-14010 support Homogenues array floating point forcing(deserializa…Feb 18, 2026
Comment threadfuzz/fuzz_targets/fuzz_binary_decode.rs Outdated
Comment threadsrc/binary.rs Outdated
Comment thread.github/actions/fuzz_tests/action.yml
@RedisJSONRedisJSON deleted a comment from cursorBotFeb 22, 2026
Comment threadsrc/cbor.rs
Comment threadsrc/cbor.rs
@galcohen-redislabs

Copy link
Copy Markdown

Did you look at c2pa_cbor?

Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/src/lib.rs Outdated
@AvivDavid23

Copy link
Copy Markdown
Author

Did you look at c2pa_cbor?

@galcohen-redislabs I can try that, although it doesnt have a major release, and very low usage:
image

Comment threadsrc/de.rs
Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/fuzz_targets/fuzz_json_de.rs Outdated
Comment threadsrc/cbor.rs
Comment threadsrc/array.rs
Comment threadsrc/array.rs
Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/src/lib.rs Outdated
Comment threadfuzz/src/lib.rs Outdated

@cursorcursorBot 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.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Comment threadsrc/cbor.rs
Comment threadsrc/cbor.rs
@AvivDavid23
AvivDavid23 merged commit 259d8ac into masterMar 3, 2026
5 checks passed
@GuyAv46

Copy link
Copy Markdown

What are the implications for the C API? How can we use this optimization?

@AvivDavid23

Copy link
Copy Markdown
Author

What are the implications for the C API? How can we use this optimization?
@GuyAv46
RedisJSON/RedisJSON#1521

Sign up for freeto 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.

3 participants

@AvivDavid23@galcohen-redislabs@GuyAv46