question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bridge performance: Using JSON-Strings is faster than WritableMap/WritableArray

See original GitHub issue

Coming from this issue: #8780

I’ve put together a benchmark calling the bridge and receiving various objects. It compares:

  1. call and receive an object using WritableMap/WritableArray.
  2. call and receive the same object by using the gson library to serialise it to a String, then deserialise it using JSON.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:closed
  • Created 7 years ago
  • Comments:21 (8 by maintainers)

github_iconTop GitHub Comments

7reactions
fab1ancommented, Dec 30, 2017

Closing this, because I don’t think it will ever get fixed. Have a nice good new year.

5reactions
fab1ancommented, Jul 22, 2017

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found