-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add benchmark for babel transform * Avoid doing I/O in the benchmark fn * nit * reorder imports
- Loading branch information
Showing
4 changed files
with
70 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import {readFileSync} from 'fs' | ||
import {resolve} from 'path' | ||
import Benchmark from 'benchmark' | ||
import {transform as babel} from 'babel-core' | ||
|
||
import plugin from '../src/babel' | ||
|
||
const read = path => readFileSync(resolve(__dirname, path), 'utf8') | ||
const fixture = read('./fixtures/babel.js') | ||
|
||
module.exports = new Benchmark({ | ||
name: 'Babel transform', | ||
minSamples: 500, | ||
fn: () => { | ||
babel(fixture, { | ||
babelrc: false, | ||
plugins: [plugin] | ||
}) | ||
} | ||
}) |
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,38 @@ | ||
export const Test1 = () => ( | ||
<div> | ||
<span>test</span> | ||
<span>test</span> | ||
<p></p><p></p><p></p><p></p><p></p><p></p><p></p> | ||
<p><span></span></p><p><span></span></p><p><span></span></p> | ||
<p></p><p></p><p></p><p></p><p></p><p></p><p></p> | ||
<p><span></span></p><p><span></span></p><p><span></span></p> | ||
<p></p><p></p><p></p><p></p><p></p><p></p><p></p> | ||
<p><span></span></p><p><span></span></p><p><span></span></p> | ||
<Component /> | ||
<style jsx>{` | ||
span { color: red; } | ||
p { color: red; } | ||
`}</style> | ||
</div> | ||
) | ||
|
||
export const Test2 = () => <span>test</span> | ||
|
||
export default class { | ||
render() { | ||
return ( | ||
<div> | ||
<p>test</p> | ||
<style jsx>{` | ||
p { color: red; } | ||
`}</style> | ||
<style jsx>{` | ||
p { color: red; } | ||
`}</style> | ||
<style jsx>{` | ||
p { color: red; } | ||
`}</style> | ||
</div> | ||
) | ||
} | ||
} |
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