Skip to content
This repository has been archived by the owner on May 12, 2020. It is now read-only.

Commit

Permalink
Merge pull request #198 from peitschie/benchmark-cc
Browse files Browse the repository at this point in the history
Compile the benchmark file set using CC
  • Loading branch information
Jos van den Oever committed Nov 21, 2013
2 parents 48f62e2 + bbf9272 commit c5b1bcd
Show file tree
Hide file tree
Showing 25 changed files with 198 additions and 19 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,8 @@ add_custom_command(
# editor
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/programs/editor ${WEBODFZIPDIR}/editor
COMMAND ${CMAKE_COMMAND} -E remove_directory ${WEBODFZIPDIR}/editor/dojo-deps
# benchmark
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/programs/benchmark ${WEBODFZIPDIR}/benchmark
# wordpressplugin
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/programs/wordpressplugin/readme.txt ${WEBODFZIPDIR}/wordpressplugin-readme.txt
COMMAND ${CMAKE_COMMAND} -E copy ${WORDPRESSZIP} ${WEBODFZIPDIR}
Expand All @@ -436,6 +438,7 @@ add_custom_command(
webodf-debug.js-target
webodf.js-target
editor-compiled.js-target
html-benchmark
viewer-minimized.js-target
firefoxextension-target
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
Expand Down
1 change: 1 addition & 0 deletions programs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ add_subdirectory(firefoxextension)

add_subdirectory(touchui)
add_subdirectory(playbook)
add_subdirectory(benchmark)
add_subdirectory(editor)
add_subdirectory(viewer)
add_subdirectory(wordpressplugin)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
37 changes: 37 additions & 0 deletions programs/benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
COPY_FILES(BENCHMARK_HTML ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
1page.odt
10pages.odt
100pages.odt
1000pages.odt
index.html
)

FILE(GLOB BENCHMARK_JS "${CMAKE_CURRENT_SOURCE_DIR}/js/*.js")

FOREACH(JSFILE ${BENCHMARK_JS})
set(BENCHMARK_CLOSURE_ARGS ${BENCHMARK_CLOSURE_ARGS} --js ${JSFILE})
ENDFOREACH(JSFILE)

add_custom_command(
OUTPUT benchmark.js-target

# from webodf.js target (DEPENDS webodf.js)
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/webodf/webodf.js ${CMAKE_CURRENT_BINARY_DIR}

COMMAND ${Java_JAVA_EXECUTABLE}
ARGS -jar ${CLOSURE_JAR}
${BENCHMARK_CLOSURE_ARGS}
--transform_amd_modules
--process_common_js_modules
--common_js_entry_module HTMLBenchmark.js
--common_js_module_path_prefix ${CMAKE_CURRENT_SOURCE_DIR}/js
--compilation_level SIMPLE_OPTIMIZATIONS
--formatting PRETTY_PRINT
--js_output_file "benchmark.js-"

COMMAND ${CMAKE_COMMAND} ARGS -E rename "benchmark.js-" "benchmark.js"

DEPENDS ClosureCompiler webodf.js-target
)

add_custom_target(html-benchmark DEPENDS benchmark.js-target ${BENCHMARK_HTML})
121 changes: 121 additions & 0 deletions programs/benchmark/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<!DOCTYPE html>
<html>
<head>
<title>WebODF performance and benchmarking tool</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style>
body {
font-family: Helvetic, sans-serif;
}

#benchmarkView {
position: fixed;
top: 0;
bottom: 0;
width: 400px;
left: 0;
background-color: #70a186;
}

#documentView {
position: fixed;
top: 0;
bottom: 0;
left: 400px;
right: 0;
overflow: auto;
}

#benchmarkResults .status {
display: none;
}

#documentView *:focus {
outline: none;
}

#wizardPrompt {
position: fixed;
top: 20px;
right: 20px;
border: 1px solid orangered;
background-color: orange;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
min-width: 100px;
min-height: 100px;
padding: 10px;
text-align: center;
display: none;
z-index: 100;
}

#wizardMessage {
text-align: left;
}

#wizardPrompt h2 {
margin: 0;
color: #671a00;
}

#loadingScreen {
position: fixed;
top: 100px;
left: 100px;
right: 100px;
background-color: #c3c3c3;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border: 1px solid black;
text-align: center;
vertical-align: middle;
z-index: 100;
}
</style>

<script src="webodf.js" type="text/javascript"></script>
<script type="text/javascript">
runtime.currentDirectory = function () {
return "../../webodf/lib";
};
runtime.libraryPaths = function () {
return [
runtime.currentDirectory(),
"../../../webodf/lib"
];
};
</script>

</head>
<body>
<div id="loadingScreen">
<h1>Loading required files. This may take a while.</h1>
</div>
<div id="benchmarkView">
<h1>Benchmark results</h1>
<table id="benchmarkResults">
<thead>
<tr>
<td class="action">Action</td>
<td class="status">Status</td>
<td class="elapsed">Elapsed time (ms)</td>
</tr>
</thead>
</table>
</div>
<div id="documentView">
<div id="wizardPrompt">
<h2>Interaction required:</h2>
<div id="wizardMessage"></div>
<button id="wizardClose">Done!</button>
</div>
<div id="canvas"></div>
</div>
<script src="benchmark.js" type="text/javascript"></script>
<script>
var benchmark = new module$HTMLBenchmark();
benchmark.start();
</script>
</body>
</html>
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* @source: https://github.com/kogmbh/WebODF/
*/

require([
define([
"Benchmark",
"HTMLResultsRenderer",
"LoadDocument",
Expand All @@ -51,25 +51,33 @@ require([
LoadDocument, EnterEditMode, MoveCursorToEndDirect,InsertLetterA, Remove1Position, MoveCursor1StepLeft,
SelectEntireDocument, RemoveCurrentSelection) {
"use strict";
var loadingScreen = document.getElementById('loadingScreen'),
fileUrl = window.location.hash.substr(1) || "100pages.odt",
benchmark = new Benchmark();

new HTMLResultsRenderer(benchmark);
/**
* @constructor
*/
function HTMLBenchmark() {
var loadingScreen = document.getElementById('loadingScreen'),
fileUrl = window.location.hash.substr(1) || "100pages.odt",
benchmark = new Benchmark();

loadingScreen.style.display = "none";
new HTMLResultsRenderer(benchmark);

benchmark.actions.push(new LoadDocument(fileUrl));
benchmark.actions.push(new EnterEditMode());
// TODO currently times out
// benchmark.addAction(new MoveCursorToEndViaCtrlEnd());
benchmark.actions.push(new MoveCursorToEndDirect());
benchmark.actions.push(new InsertLetterA());
benchmark.actions.push(new Remove1Position(true));
benchmark.actions.push(new MoveCursor1StepLeft());
benchmark.actions.push(new Remove1Position(false));
benchmark.actions.push(new SelectEntireDocument());
benchmark.actions.push(new RemoveCurrentSelection());
loadingScreen.style.display = "none";

benchmark.start();
benchmark.actions.push(new LoadDocument(fileUrl));
benchmark.actions.push(new EnterEditMode());
// TODO currently times out
// benchmark.addAction(new MoveCursorToEndViaCtrlEnd());
benchmark.actions.push(new MoveCursorToEndDirect());
benchmark.actions.push(new InsertLetterA());
benchmark.actions.push(new Remove1Position(true));
benchmark.actions.push(new MoveCursor1StepLeft());
benchmark.actions.push(new Remove1Position(false));
benchmark.actions.push(new SelectEntireDocument());
benchmark.actions.push(new RemoveCurrentSelection());

this.start = benchmark.start;
}

return HTMLBenchmark;
});
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
define(function() {
"use strict";

/**
* @constructor
*/
function ManualStep() {
var wizardContainer = document.getElementById("wizardPrompt"),
messageContainer = document.getElementById("wizardMessage"),
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,10 @@
];
};
</script>
<script data-main="js/main" src="js/require.js"></script>
<script src="require.js"></script>
<script type="text/javascript">
requirejs.config({
baseUrl: "js",
waitSeconds: 0 // some servers are reaaaallly slow unfortunately :/
});
requirejs.onError = function (err) {
Expand All @@ -99,6 +100,11 @@

throw err;
};

require(["HTMLBenchmark"], function(HTMLBenchmark) {
var benchmark = new HTMLBenchmark();
benchmark.start();
})
</script>
</head>
<body>
Expand Down
File renamed without changes.

0 comments on commit c5b1bcd

Please sign in to comment.