Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
44 lines (36 loc) · 1.27 KB

File metadata and controls

44 lines (36 loc) · 1.27 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import time
from react.render import render_component
from .settings import Components
def median(l):
half = int(len(l) / 2)
l.sort()
if len(l) % 2 == 0:
return (l[half-1] + l[half]) / 2.0
else:
return l[half]
def run_perf_test():
render_component_times = []
rendered_components = []
iteration_count = 25
for i in range(iteration_count):
start = time.time()
rendered_components.append(
render_component(
Components.PERF_TEST,
{'name': 'world'},
to_static_markup=True,
)
)
end = time.time()
render_component_times.append(end - start)
for component in rendered_components:
assert str(component) == '<span>Hello world</span>'
print('Total time taken to render a component {iteration_count} times: {value}'.format(
iteration_count=iteration_count,
value=sum(render_component_times)
))
print('Times: {}'.format(render_component_times))
print('Max: {}'.format(max(render_component_times)))
print('Min: {}'.format(min(render_component_times)))
print('Mean: {}'.format(sum(render_component_times) / len(render_component_times)))
print('Median: {}'.format(median(render_component_times)))
Morty Proxy This is a proxified and sanitized view of the page, visit original site.