I've taken the benchmarks from Matthew Rothenberg's phoenix-showdown, updated Phoenix to 0.13.1 and ran the tests on the most powerful machines available at Rackspace.
| Framework | Throughput (req/s) | Latency (ms) | Consistency (σ ms) |
|---|
| 'use strict'; | |
| var React = require('react'); | |
| function createAsyncHandler(getHandlerAsync, displayName) { | |
| var Handler = null; | |
| return React.createClass({ | |
| displayName: displayName, |
| // Usage example: | |
| // | |
| // willTransitionTo(transition, params, query, callback) { | |
| // observeStore(DraftStore, s => s.isLoaded()).then(() => { | |
| // if (DraftStore.isMissingTitle()) { | |
| // transition.redirect('composeDraft', params); | |
| // } | |
| // }).finally(callback); | |
| // } |
| // array utils | |
| // ================================================================================================= | |
| const combine = (...arrays) => [].concat(...arrays); | |
| const compact = arr => arr.filter(Boolean); | |
| const contains = (() => Array.prototype.includes | |
| ? (arr, value) => arr.includes(value) | |
| : (arr, value) => arr.some(el => el === value) |
I've taken the benchmarks from Matthew Rothenberg's phoenix-showdown, updated Phoenix to 0.13.1 and ran the tests on the most powerful machines available at Rackspace.
| Framework | Throughput (req/s) | Latency (ms) | Consistency (σ ms) |
|---|
React introduced shallow rendering in 0.13. This is an excellent feature that I wish was included earlier in React. It aims to solve the problem of unit testing components without going through a real, or jsdom mocked, DOM. I couldn't find any info online about what lifecycle events it actually fires. So I did some testing of my own. To reproduce, put component.js and test.js into a folder and run node test.js.
TLDR; shallow rendering only invokes the following lifecycle hooks (in order):
getDefaultPropsgetInitialStatecomponentWillMount stops here until re-rendercomponentWillReceivePropsshouldComponentUpdatecomponentWillUpdate| (require 'package) | |
| (require 'cl) | |
| ;; Load anything in site-lisp | |
| (eval-and-compile | |
| (mapc | |
| #'(lambda (path) | |
| (push (expand-file-name path user-emacs-directory) load-path)) | |
| '("site-lisp"))) |
| import createHistory from 'history/lib/createBrowserHistory'; | |
| import createStore from './redux/createStore'; | |
| import createRoutes from './routes'; | |
| import React from 'react'; | |
| import { Provider } from 'react-redux'; | |
| import { Router } from 'react-router'; | |
| import { render } from 'react-dom'; | |
| const history = createHistory(); | |
| const store = createStore(history, window.__data); |
Should be work with 0.18
Destructuring(or pattern matching) is a way used to extract data from a data structure(tuple, list, record) that mirros the construction. Compare to other languages, Elm support much less destructuring but let's see what it got !
myTuple = ("A", "B", "C")
myNestedTuple = ("A", "B", "C", ("X", "Y", "Z"))| import React from 'react'; | |
| import { shallow } from 'enzyme'; | |
| import MyComponent from '../src/my-component'; | |
| const wrapper = shallow(<MyComponent/>); | |
| describe('(Component) MyComponent', () => { | |
| it('renders without exploding', () => { | |
| expect(wrapper).to.have.length(1); | |
| }); |
| machine: | |
| pre: | |
| - mkdir ~/.yarn-cache | |
| dependencies: | |
| pre: | |
| - curl -o- -L https://yarnpkg.com/install.sh | bash | |
| cache_directories: | |
| - ~/.yarn-cache | |
| override: |