Commit af75e21a by FritzFlorian

Add benchmark results from running on x86 and arm32.

parent 3f7b5ad0
Pipeline #1381 failed with stages
in 35 seconds
......@@ -4,7 +4,7 @@ if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND CMAKE_SYSTEM_NAME STREQUAL "Lin
SET(SWITCH_ASSEMBLY "custom_stack_callback_x86_64.s")
SET(FIBER_ASSEMBLY "fiber_call_x86_64.s" "fiber_continue_x86_64.s")
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l" AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
SET(SWITCH_ASSEMBLY "custom_stack_callback_arm32.s" fiber_call.h fiber_call.cpp)
SET(SWITCH_ASSEMBLY "custom_stack_callback_arm32.s" fiber_call.h context_switcher.cpp)
SET(FIBER_ASSEMBLY "fiber_call_arm32.s" "fiber_continue_arm32.s")
else ()
MESSAGE(FATAL_ERROR "Platform (${CMAKE_SYSTEM_PROCESSOR} on ${CMAKE_SYSTEM_NAME}) not supported! Please see Readme for instructions to port.")
......@@ -14,7 +14,7 @@ endif ()
add_executable(context_switch
main.cpp
${SWITCH_ASSEMBLY}
fiber_call.h fiber_call.cpp
fiber_call.h
${FIBER_ASSEMBLY})
# Example for adding the library to your app (as a cmake project dependency)
......
......@@ -71,6 +71,7 @@ target_include_directories(fcontext
PRIVATE include/fcontext
INTERFACE include)
set_property(TARGET fcontext PROPERTY INTERPROCEDURAL_OPTIMIZATION FALSE)
set_target_properties(fcontext PROPERTIES FOLDER Deps ${IOS_GENERAL_PROPERTIES})
install(TARGETS fcontext DESTINATION lib)
......
#include "fiber_call.h"
namespace pls {
namespace internal {
namespace base {
}
}
}
Output on the banana pi
Base
Function Call : 4975613, 4.97561
Simple Loop : 1269267, 1.26927
Longjmp
Stack Switching : 11255742, 11.25574
Full Continuation: 54504045, 54.50404
Jump Continuation: 128717262, 128.71727
Boost
FContext Fast : 51930723, 51.93073
FContext Clean : 57454099, 57.45410
FContext CallCC : 101296455, 101.29646
Custom
Custom Fast Call : 23745875, 23.74588
Used stack size about 92 bytes.
import numpy as np
from matplotlib import pyplot as plt
labels = ['loop overhead',
'function call',
'stack switching',
'setjmp + stack switching',
'fcontext switch, return',
'fcontext create, switch, return',
'pseudo callcc',
'custom'
]
call_color = (0.3, 0.1, 0.4, 0.6)
setjmp_color = (0.3, 0.3, 0.4, 0.6)
fcontext_color = (0.3, 0.6, 0.4, 0.6)
custom_color = (0.3, 1.0, 0.4, 0.6)
colors = [
call_color,
call_color,
setjmp_color,
setjmp_color,
fcontext_color,
fcontext_color,
fcontext_color,
custom_color
]
dataX86 = np.array([
0.55,
2.79,
5.60,
14.93,
9.51,
11.00,
18.66,
7.86,
])
dataARM32 = np.array([ # TODO: Run and fill in data...damn that laptop crash
1.26,
4.97,
11.25,
54.50,
51.93,
57.45,
101.29,
23.74,
])
data = dataARM32
assert (len(labels) == len(data), "Must fill in all data!")
xAxis = np.array(range(0, len(labels)))
plt.bar(xAxis, data, color=colors)
plt.xticks(xAxis, labels, rotation=90)
plt.ylabel('runtime in ns')
plt.subplots_adjust(bottom=0.5, top=0.98)
plt.show()
Output on my x86_64 laptop:
- Ubuntu 18.04.3 LTS
- Core i7-8550U CPU @1.80 GHz (turbo boost/frequency scaling disabled)
- Results of best run using nice -20
Base
Function Call : 2796349, 2.79635
Simple Loop : 557062, 0.55706
Longjmp
Stack Switching : 5602146, 5.60215
Full Continuation: 14935945, 14.93594
Jump Continuation: 33523215, 33.52322
Boost
FContext Fast : 9517573, 9.51757
FContext Clean : 11006061, 11.00606
FContext CallCC : 18661906, 18.66191
Custom
Custom Fast Call : 7860666, 7.86067
Used stack size about 32 bytes.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment