Bridge performance: Using JSON-Strings is faster than WritableMap/WritableArray
See original GitHub issueComing from this issue: #8780
I’ve put together a benchmark calling the bridge and receiving various objects. It compares:
- call and receive an object using
WritableMap/WritableArray
. - call and receive the same object by using the
gson
library to serialise it to a String, then deserialise it usingJSON.parse
.
The benchmark shows that using Json strings is faster than using WritableMap/WritableArray
, especially with arrays.
Source: https://github.com/fab1an/react-native-test/tree/testArguments
Updated results after improvements
The results:
- Simple Object: GSON is 3% faster
test_obj_simple_rn x 493 ops/sec ±1.83% (133 runs sampled)
test_obj_simple_json x 507 ops/sec ±1.56% (135 runs sampled)
- More complex, nested object: GSON is 51% faster
test_obj_complex_rn x 270 ops/sec ±1.96% (134 runs sampled)
test_obj_complex_json x 408 ops/sec ±1.67% (134 runs sampled)
- 10-element array of integers: equal
test_array_num_small_rn x 500 ops/sec ±1.54% (134 runs sampled)
test_array_num_small_json x 501 ops/sec ±1.84% (133 runs sampled)
- 1000-element array of integers: GSON is 64% faster
test_array_num_large_rn x 76.41 ops/sec ±1.54% (135 runs sampled)
test_array_num_large_json x 125 ops/sec ±1.61% (133 runs sampled)
- 10-element array of strings: GSON is 5% faster
test_array_str_small_rn x 469 ops/sec ±1.79% (133 runs sampled)
test_array_str_small_json x 490 ops/sec ±1.78% (133 runs sampled)
- 1000-element array of strings: GSON is 90% faster
test_array_str_large_rn x 44.78 ops/sec ±2.03% (134 runs sampled)
test_array_str_large_json x 85.04 ops/sec ±1.40% (134 runs sampled)
Issue Analytics
- State:
- Created 7 years ago
- Comments:21 (8 by maintainers)
Top Results From Across the Web
Long‐term bridge performance assessment using clustering ...
This study proposes a novel bridge safety condition assessment method that utilizes long-term monitoring data from the WIM system and the SHM ...
Read more >Long-Term Bridge Performance High Priority Bridge ...
Understanding bridge performance is a key factor in a State transportation department's ability to address current bridge deficiencies (functional as well as ...
Read more >Development of a Robust Framework for Assessing Bridge ...
This performance is a result of the bridges selected via ... and then the deterioration rate increases faster as the age of a...
Read more >Performance Estimates for Seismically Isolated Bridges
This report presents an analytical study investigating the performance of an isolated bridge structure subjected to seismic excitation.
Read more >1 ASSESSING BRIDGE PERFORMANCE
This paper outlines the value of assessing bridge performance of major bridges that ... better understanding of bridge behavior, better analysis and design ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Closing this, because I don’t think it will ever get fixed. Have a nice good new year.
@hramos That sounds like a good policy. Additionally I’d focus on open issues with developers who are willing to put time into producing additional info or working test-code like me. 😉
I’m a fan of RN as well.