mjmeintjes / boot-react-native

Better development experience with ClojureScript and React Native
117 stars 14 forks source link

RN 29 packager: slow reloads #57

Closed pesterhazy closed 8 years ago

pesterhazy commented 8 years ago

With https://github.com/pesterhazy/boot-react-native/tree/develop, SimpleExampleApp reloading works again. However, if I make a change and then use Cmd+R in the simulator to reload completely, it take 30 seconds or more. This used work in <5 seconds.

Some observations:

pesterhazy commented 8 years ago

When run using boot -v dev, boot reports that it links out a few files, ones that have actually, and touch a few others. Is there a way to make boot not touch the files that haven't changed?

Writing target dir(s)...
Filesystem: touching node_modules/goog.net.XhrIo.ResponseType.js...
Filesystem: touching node_modules/goog.net.WebSocket.js...
Filesystem: touching node_modules/goog.string.TypedString.js...
Filesystem: touching node_modules/goog.net.xpc.TransportTypes.js...
Filesystem: linking node_modules/mattsum.boot_react_native.shim_repl_print.js...
Filesystem: touching node_modules/goog.math.Size.js...
Filesystem: touching node_modules/goog.net.xpc.IframePollingTransport.Sender.js...
Filesystem: touching node_modules/goog.dom.safe.InsertAdjacentHtmlPosition.js...
Filesystem: linking node_modules/mattsum.simple_example.core.js...
Filesystem: touching node_modules/goog.log.Logger.js...
Filesystem: touching node_modules/goog.async.FreeList.js...
Filesystem: touching node_modules/goog.async.Delay.js...
Filesystem: touching node_modules/cljsjs.react.dom.js...
Filesystem: touching node_modules/goog.net.XmlHttp.ReadyState.js...
Filesystem: touching node_modules/goog.html.uncheckedconversions.js...
Filesystem: touching node_modules/goog.userAgent.js...
Filesystem: linking main.out/mattsum/boot_react_native/shim_boot_reload.js...
Filesystem: touching node_modules/goog.messaging.AbstractChannel.js...
Filesystem: touching main.out/goog/deps.js...
Filesystem: touching node_modules/goog.events.EventId.js...
Filesystem: touching node_modules/goog.messaging.MessageChannel.js...
Filesystem: linking node_modules/mattsum.boot_react_native.shim_boot_reload.js...
Filesystem: touching node_modules/goog.net.XhrLike.js...
Filesystem: touching node_modules/goog.net.WrapperXmlHttpFactory.js...
Filesystem: touching node_modules/goog.events.ListenableType.js...
Filesystem: touching node_modules/goog.net.xpc.js...
Filesystem: touching node_modules/goog.log.js...
Filesystem: touching main.out/mattsum/boot_react_native/shim_browser_repl_bootstrap.cljs...
Filesystem: linking main.out/adzerk/boot_reload.cljs.cache.edn...
Filesystem: touching node_modules/goog.Disposable.js...
Filesystem: touching node_modules/goog.events.EventType.js...
Filesystem: touching node_modules/reagent.dom.js...
Filesystem: touching node_modules/goog.functions.js...
Filesystem: touching node_modules/goog.async.throwException.js...
Filesystem: touching node_modules/clojure.string.js...
Filesystem: touching node_modules/goog.math.Coordinate.js...
Filesystem: touching node_modules/goog.net.xpc.IframePollingTransport.js...
Filesystem: touching node_modules/goog.net.xpc.FrameElementMethodTransport.js...
Filesystem: touching node_modules/goog.html.SafeHtml.js...
Filesystem: touching main.js...
Filesystem: linking main.out/mattsum/boot_react_native/shim_repl_print.js...
Filesystem: touching node_modules/goog.events.EventLike.js...
Filesystem: touching node_modules/goog.html.TrustedResourceUrl.js...
Filesystem: touching node_modules/reagent.impl.component.js...
Filesystem: touching node_modules/goog.net.XmlHttp.js...
Filesystem: touching node_modules/goog.Timer.js...
Filesystem: touching node_modules/goog.events.Listener.js...
Filesystem: touching node_modules/cljs.test.js...
Filesystem: touching node_modules/goog.i18n.bidi.js...
Filesystem: touching node_modules/goog.i18n.bidi.Dir.js...
Filesystem: touching node_modules/cljsjs.react.dom.server.js...
Filesystem: touching node_modules/goog.Uri.js...
Filesystem: touching node_modules/adzerk.boot_cljs_repl.js...
Filesystem: touching node_modules/goog.async.run.js...
Filesystem: touching dist.cljs.edn...
Filesystem: touching node_modules/goog.net.DefaultXmlHttpFactory.js...
Filesystem: touching node_modules/goog.net.WebSocket.ErrorEvent.js...
Filesystem: touching main.out/mattsum/boot_react_native/shim_boot_reload.cljs...
Filesystem: touching node_modules/mattsum.boot_react_native.shim_browser_repl_bootstrap.js.map...
Filesystem: touching node_modules/cljs.core.js...
Filesystem: touching node_modules/goog.net.EventType.js...
Filesystem: touching node_modules/adzerk.boot_reload.connection.js...
Filesystem: touching node_modules/cljs.pprint.js...
Filesystem: touching node_modules/goog.debug.LogRecord.js...
Filesystem: touching node_modules/mattsum.boot_react_native.shim_repl_print.js.map...
Filesystem: touching node_modules/goog.dom.BrowserFeature.js...
Filesystem: touching node_modules/goog.html.SafeStyle.js...
Filesystem: touching node_modules/goog.debug.Loggable.js...
Filesystem: touching node_modules/goog.net.xpc.NativeMessagingTransport.js...
Filesystem: touching node_modules/adzerk.boot_reload.client.js...
Filesystem: touching main.out/goog/net/jsloader.js...
Filesystem: touching node_modules/goog.promise.Resolver.js...
Filesystem: touching node_modules/goog.Delay.js...
Filesystem: touching node_modules/goog.iter.js...
Filesystem: linking node_modules/mattsum.simple_example.core.js.map...
Filesystem: touching node_modules/goog.events.ListenerMap.js...
Filesystem: touching node_modules/goog.net.xpc.CrossPageChannelRole.js...
Filesystem: touching node_modules/goog.events.CaptureSimulationMode.js...
Filesystem: touching node_modules/cljs.reader.js...
Filesystem: touching node_modules/goog.net.XmlHttpDefines.js...
Filesystem: touching node_modules/goog.async.nextTick.js...
Filesystem: touching node_modules/goog.events.js...
Filesystem: touching node_modules/goog.iter.Iterable.js...
Filesystem: touching node_modules/weasel.repl.js...
Filesystem: touching node_modules/goog.uri.utils.QueryArray.js...
Filesystem: touching node_modules/goog.structs.Collection.js...
Filesystem: touching node_modules/goog.string.StringBuffer.js...
Filesystem: touching main.out/goog/base.js...
Filesystem: touching node_modules/goog.string.js...
Filesystem: touching node_modules/adzerk.boot_reload.display.js...
Filesystem: touching node_modules/goog.net.WebSocket.MessageEvent.js...
Filesystem: touching node_modules/goog.html.SafeUrl.js...
Filesystem: touching node_modules/goog.fs.url.js...
Filesystem: touching main.out/mattsum/boot_react_native/shim_boot_reload.cljs.cache.edn...
Filesystem: touching node_modules/goog.math.js...
Filesystem: touching node_modules/goog.debug.Error.js...
Filesystem: touching node_modules/cljs.repl.js...
Filesystem: touching node_modules/goog.net.xpc.ChannelStates.js...
Filesystem: touching node_modules/goog.dom.tags.js...
Filesystem: touching node_modules/mattsum.boot_react_native.shim_browser_repl_bootstrap.cljs...
Filesystem: touching node_modules/clojure.browser.repl.js...
Filesystem: touching node_modules/goog.debug.Logger.Level.js...
Filesystem: touching node_modules/adzerk.boot_reload.js...
Filesystem: touching node_modules/goog.string.Unicode.js...
Filesystem: touching node_modules/goog.async.WorkItem.js...
Filesystem: touching node_modules/goog.json.Serializer.js...
Filesystem: touching node_modules/goog.debug.EntryPointMonitor.js...
Filesystem: touching node_modules/goog.i18n.bidi.DirectionalString.js...
Filesystem: touching node_modules/boot.cljs.main26911.cljs...
Filesystem: touching node_modules/goog.array.ArrayLike.js...
Filesystem: touching node_modules/goog.events.Event.js...
Filesystem: touching node_modules/goog.events.BrowserEvent.MouseButton.js...
Filesystem: touching node_modules/goog.json.Replacer.js...
Filesystem: touching node_modules/goog.string.Const.js...
Filesystem: touching node_modules/goog.Uri.QueryData.js...
Filesystem: touching node_modules/reagent.core.js...
Filesystem: touching node_modules/goog.net.jsloader.Options.js...
Filesystem: touching node_modules/goog.dom.Appendable.js...
Filesystem: touching main.out/mattsum/boot_react_native/shim_browser_repl_bootstrap.cljs.cache.edn...
Filesystem: touching node_modules/goog.events.ListenableKey.js...
Filesystem: touching node_modules/goog.events.EventHandler.js...
Filesystem: touching node_modules/goog.reflect.js...
Filesystem: touching main.out/adzerk/boot_reload.js...
Filesystem: touching node_modules/goog.net.jsloader.js...
Filesystem: touching node_modules/reagent.impl.template.js...
Filesystem: touching node_modules/goog.net.WebSocket.EventType.js...
Filesystem: touching main.out/mattsum/boot_react_native/shim_boot_reload.js.map...
Filesystem: touching node_modules/goog.disposable.IDisposable.js...
Filesystem: touching node_modules/goog.labs.userAgent.util.js...
Filesystem: linking main.out/mattsum/simple_example/core.js...
Filesystem: touching node_modules/reagent.impl.util.js...
Filesystem: touching node_modules/goog.debug.entryPointRegistry.js...
Filesystem: touching node_modules/goog.array.js...
Filesystem: touching node_modules/goog.net.xpc.IframePollingTransport.Receiver.js...
Filesystem: linking main.out/mattsum/boot_react_native/shim_repl_print.cljs.cache.edn...
Filesystem: touching node_modules/clojure.browser.event.js...
Filesystem: touching node_modules/goog.net.xpc.Transport.js...
Filesystem: linking main.out/mattsum/simple_example/core.js.map...
Filesystem: touching node_modules/goog.async.Deferred.AlreadyCalledError.js...
Filesystem: touching node_modules/mattsum.boot_react_native.shim_boot_reload.cljs...
Filesystem: touching node_modules/mattsum.boot_react_native.shim_boot_reload.js.map...
Filesystem: touching node_modules/goog.object.js...
Filesystem: touching node_modules/adzerk.boot_reload.websocket.js...
Filesystem: touching node_modules/goog.debug.LogBuffer.js...
Filesystem: touching node_modules/goog.html.SafeStyleSheet.js...
Filesystem: touching node_modules/goog.iter.Iterator.js...
Filesystem: touching node_modules/goog.uri.utils.js...
Filesystem: touching node_modules/goog.net.xpc.CrossPageChannel.js...
Filesystem: touching node_modules/reagent.debug.js...
Filesystem: touching node_modules/goog.dom.TagName.js...
Filesystem: touching node_modules/goog.net.ErrorCode.js...
Filesystem: touching main.out/adzerk/boot_reload.js.map...
Filesystem: touching node_modules/goog.debug.LogManager.js...
Filesystem: touching node_modules/goog.net.jsloader.Error.js...
Filesystem: touching node_modules/goog.dispose.js...
Filesystem: touching main.out/boot/cljs/main26911.js...
Filesystem: touching node_modules/goog.debug.js...
Filesystem: touching node_modules/boot.cljs.main26911.js...
Filesystem: touching node_modules/goog.log.Level.js...
Filesystem: touching node_modules/goog.i18n.bidi.Format.js...
Filesystem: touching main.out/mattsum/boot_react_native/shim_repl_print.js.map...
Filesystem: touching node_modules/goog.userAgent.product.js...
Filesystem: touching node_modules/goog.dom.DomHelper.js...
Filesystem: touching node_modules/goog.log.LogRecord.js...
Filesystem: touching node_modules/goog.net.xpc.DirectTransport.js...
Filesystem: touching node_modules/mattsum.boot_react_native.shim_browser_repl_bootstrap.js...
Filesystem: touching node_modules/goog.html.SafeScript.js...
Filesystem: touching node_modules/goog.json.Reviver.js...
Filesystem: touching main.out/boot/cljs/main26911.cljs.cache.edn...
Filesystem: touching node_modules/goog.events.Listenable.js...
Filesystem: touching node_modules/goog.Thenable.js...
Filesystem: touching node_modules/goog.debug.Logger.js...
Filesystem: touching node_modules/clojure.set.js...
Filesystem: touching main.out/mattsum/boot_react_native/shim_browser_repl_bootstrap.js...
Filesystem: touching node_modules/boot.cljs.main26911.js.map...
Filesystem: touching node_modules/goog.async.WorkQueue.js...
Filesystem: touching node_modules/goog.async.DeferredList.js...
Filesystem: touching main.out/cljs_deps.js...
Filesystem: touching node_modules/goog.asserts.AssertionError.js...
Filesystem: touching node_modules/mattsum.simple_example.core.cljs...
Filesystem: touching node_modules/goog.events.BrowserFeature.js...
Filesystem: touching node_modules/goog.json.js...
Filesystem: touching node_modules/reagent.impl.batching.js...
Filesystem: touching node_modules/goog.labs.userAgent.browser.js...
Filesystem: touching node_modules/goog.uri.utils.QueryValue.js...
Filesystem: touching main.out/mattsum/boot_react_native/shim_browser_repl_bootstrap.js.map...
Filesystem: touching node_modules/clojure.browser.net.js...
Filesystem: touching main.out/boot/cljs/main26911.js.map...
Filesystem: touching node_modules/goog.disposeAll.js...
Filesystem: touching node_modules/goog.asserts.js...
Filesystem: touching node_modules/reagent.interop.js...
Filesystem: touching main.out/mattsum/simple_example/core.cljs...
Filesystem: touching node_modules/goog.net.XmlHttpFactory.js...
Filesystem: touching node_modules/goog.Promise.js...
Filesystem: touching node_modules/goog.js...
Filesystem: touching main.out/mattsum/simple_example/core.cljs.cache.edn...
Filesystem: touching node_modules/clojure.walk.js...
Filesystem: touching node_modules/goog.events.EventTarget.js...
Filesystem: touching node_modules/goog.dom.safe.js...
Filesystem: touching node_modules/goog.net.XhrIo.js...
Filesystem: touching node_modules/goog.net.xpc.CfgFields.js...
Filesystem: touching node_modules/goog.iter.StopIteration.js...
Filesystem: touching node_modules/goog.net.xpc.UriCfgFields.js...
Filesystem: touching node_modules/goog.net.xpc.IframeRelayTransport.js...
Filesystem: touching node_modules/goog.async.Deferred.CanceledError.js...
Filesystem: touching node_modules/reagent.dom.server.js...
Filesystem: touching node_modules/goog.net.jsloader.ErrorCode.js...
Filesystem: touching node_modules/goog.structs.js...
Filesystem: touching node_modules/goog.dom.NodeType.js...
Filesystem: touching node_modules/goog.net.XmlHttp.OptionType.js...
Filesystem: touching main.out/mattsum/boot_react_native/shim_repl_print.cljs...
Filesystem: touching node_modules/weasel.impls.websocket.js...
Filesystem: touching node_modules/goog.async.Deferred.js...
Filesystem: touching node_modules/adzerk.boot_reload.js.map...
Filesystem: touching node_modules/goog.net.xpc.TransportNames.js...
Filesystem: touching node_modules/goog.net.HttpStatus.js...
Filesystem: touching node_modules/goog.net.xpc.NixTransport.js...
Filesystem: touching node_modules/goog.labs.userAgent.platform.js...
Filesystem: touching node_modules/goog.structs.Map.js...
Filesystem: touching node_modules/goog.labs.userAgent.engine.js...
Filesystem: touching node_modules/goog.structs.Set.js...
Filesystem: touching node_modules/cljsjs.react.js...
Filesystem: touching node_modules/goog.uri.utils.StandardQueryParam.js...
Filesystem: touching main.out/boot/cljs/main26911.cljs...
Filesystem: touching node_modules/goog.dom.js...
Filesystem: touching node_modules/mattsum.boot_react_native.shim_repl_print.cljs...
Filesystem: touching node_modules/reagent.ratom.js...
Filesystem: touching node_modules/goog.events.Key.js...
Filesystem: touching node_modules/goog.events.BrowserEvent.js...
Filesystem: touching node_modules/adzerk.boot_reload.reload.js...
Filesystem: touching node_modules/goog.uri.utils.ComponentIndex.js...
pesterhazy commented 8 years ago

It looks like boot touches the target files if the input file's mtime changes, so we should look into why that happens.

pesterhazy commented 8 years ago
$ stat -f 'created="%SB" modified="%Sm" hardlinks="%l"' app/build/node_modules/reagent.ratom.js
created="Jul 29 11:56:27 2016" modified="Jul 29 11:56:27 2016" hardlinks="3"

# touch a single clojurescript file (not reagent.ratom.cljs)
# and wait for boot-cljs to recompile the file

$ bump
$ stat -f 'created="%SB" modified="%Sm" hardlinks="%l"' app/build/node_modules/reagent.ratom.js
created="Jul 29 11:56:27 2016" modified="Jul 29 12:14:57 2016" hardlinks="2"

The issue is that the file's mtime updated even though it didn't actually change; this, in turn, makes the RN packager discard the work it did in the previous run.

pesterhazy commented 8 years ago

Here's a log file of boot -v dev which shows how the files gets updated. Search for "reagent.ratom.js": https://gist.github.com/pesterhazy/56db04810cacd89660626bc6ce596297

Note that at the end it says touching node_modules/reagent.ratom.js

pesterhazy commented 8 years ago

Ok so this is fixed/worked around with https://github.com/pesterhazy/boot-react-native/commit/ecb8c89b6e470f1feefad099057a4d14f1b58e2f (although this also disables sourcemaps for now)

pesterhazy commented 8 years ago

Fixed in master. It's still not as fast as it could be (70s for initial packaging step), but most of this is cached.