-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
459 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const path = require("path"); | ||
const fableUtils = require("fable-utils"); | ||
|
||
function resolve(relativePath) { | ||
return path.join(__dirname, relativePath); | ||
} | ||
|
||
module.exports = { | ||
entry: resolve("src/MyProject.fsproj"), | ||
outDir: resolve("out"), | ||
babel: fableUtils.resolveBabelOptions({ | ||
presets: [["env", { modules: "commonjs" }]], | ||
sourceMaps: true, | ||
}), | ||
fable: { | ||
define: ["DEBUG"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module Client.Bench | ||
|
||
open Fable.Core | ||
open Fable.Core.JsInterop | ||
open Fable.PowerPack.Fetch | ||
open Client.Types | ||
open Client.View | ||
open Fable.Import.React | ||
open Fable.Import.Browser | ||
open Shared | ||
|
||
let initState: Model = { | ||
counter = Some 42 | ||
someString = "Some String" | ||
someFloat = 11.11 | ||
someInt = 22 | ||
} | ||
|
||
[<Emit("typeof process.platform !== 'undefined'")>] | ||
let isNode: bool = jsNative | ||
|
||
let jsRenderBench () = | ||
if not isNode then () else | ||
|
||
let renderToString: ReactElement -> string = importMember "react-dom/server" | ||
let mutable len = 10000 | ||
console.log(renderToString (view initState ignore)) | ||
console.time("render") | ||
while len > 0 do | ||
renderToString (view initState ignore) |> ignore | ||
len <- len - 1 | ||
console.timeEnd("render") | ||
|
||
jsRenderBench () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.