Skip to content

Instantly share code, notes, and snippets.

@dounan
Last active December 5, 2017 18:32
Show Gist options
  • Save dounan/ce7be7630d2db86635d7329077221f7b to your computer and use it in GitHub Desktop.
Save dounan/ce7be7630d2db86635d7329077221f7b to your computer and use it in GitHub Desktop.
React inline fn benchmark results
Code:
https://github.com/dounan/react-inline-fn-benchmark/tree/master
Try it out yourself here:
https://dounan.github.io/react-inline-fn-benchmark/
The numbers below show the time (ms) it takes to render 1000 buttons 1000 times.
- For the "Class property fn" tests, each button has an `onClick` callback that is a function on the button component
instance.
- For the "Inline fn" tests, each button has an `onClick` callback that is an inline arrow function.
- Tested on Browserstack.
Lower number is better.
============================
Windows 8, IE 11 (latest)
Class property fn:
6607.941791484673
6672.172929799737
6525.171704783701
Inline fn:
9510.06203302375
9308.683924912242
9413.662281099976
============================
Windows 10, IE 11 (latest)
Class property fn:
8227.669019386543
8151.2554668260855
7830.265229240031
Inline fn:
11587.859001632889
11714.827303470134
11551.07422870784
============================
Windows 10, Firefox 56.0
Class property fn:
7910.915000000001
7986.779999999999
7947.119999999995
Inline fn:
8415.42
8610.505000000001
8061.110000000001
============================
Windows 10, Chrome 62.0
Class property fn:
4680.120000000001
4693.865000000002
5022.990000000005
Inline fn:
4860.260000000001
4417.530000000001
4630.634999999998
============================
Mac Sierra, Firefox 56.0
Class property fn:
14290.59
14528.044999999998
14818.985000000008
Inline fn:
13363.599999999999
14054.190000000002
13942.714999999997
============================
Mac Sierra, Chrome 62.0
Class property fn:
5618.245000000001
5383.070000000003
5273.7149999999965
Inline fn:
5101.755000000001
5062.635000000006
5238.090000000007
============================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment