Appellererator Hyperloop vs. Simple Titanium Modules

I started playing with the Appcelerator Hyperloop. Although it seems that in order to access JS native APIs from scratch, it seems very important that several questions arise about the platform architecture and performance.

Currently (AFAIK), the Titanium application has a main user interface thread (which launches its own user interface controllers) and a JS thread (which runs the JS logic). Each call from JS to Native is passed through the "Bridge" (which is an expansive operation in the application).

In addition, the Titanium API does not cover all native APIs and abstracts as much as possible. But if new APIs are implemented, it may take time for Appcelerator to implement them on the platform.

One of my favorite things about Titanium is the ability to expand it (using objective-c for iOS and java for Android) - allowing you to use your own APIs that are not covered by Titanium, and also developing truly native performance controls in which we have to do something too heavy for js. And, as already mentioned, it is developing 100% for each platform.

Now that the Appcelerator introduced Hyperloop, I made a simple test application and saw that Hyperloop was not translated into native code, but only into regular JS code:

var UILabel = require('hyperloop/uikit/uilabel'); var label = new UILabel(); label.text = "HELLO WORLD!"; $.index.add(label); 

And one more thing is that you need to run the main thread.

So, we basically have something regarding the Hyperloop architecture:

  • Do we still have a bridge? if Hyperloop is a JS that requires a "special" Hyperloop, then we still have a bridge that now not only acts like a bridge, but also needs to do some kind of reflection (which is also an expansive operation)?
  • So far, JS has started its own thread - so now working in one main thread is apparently a potential source of an additional UI blocking operation.
  • The old-fashioned modules were really native (not including a bridge call) - so how do Hyperloop-enabled applications compare with them?

There are not many documentation or articles about Hyperloop that explain the internal workings - so if anyone has any answers, trying to use the application with it can be very helpful.

+6
source share
2 answers

Answering your questions directly:

  • Croc-Proxies is no longer involved, as actual classes are generated at runtime. This is done using the hyperlope metabase, which does a reflection (as you said) to build an AST that captures actual signatures, types, classes, methods, properties, etc.
  • At the moment, we have not seen performance problems when starting the main thread. If you do, write a JIRA ticket so we can investigate the precedent.
  • The old modules were now “less native”, simply because they were all wrapped by the Kroll proxy server (by extending each view from TiUIView and each proxy from TiProxy / TiViewProxy ). Hyperloop does not work with them, making modular development much faster, while also allowing the developer to test their process in their application without having to package and reference the module manually. Hyperloop modules are nothing more than CommonJS modules, which are already often used through alloy and other Ti components.

Hope this gives you a quick overview of how Hyperloop works. If you have further questions let us know!

Hans

+6
source

(As a detailed answer to the above comment)

So let's say you have a tabular view in iOS. The native class is UITableView , and the Titanium-API is Ti.UI.TableView / Ti.UI.ListView .

Although ListView already provides a huge performance improvement over TableView, abstracting the use of the Child-API for templates, these child-APIs ( Ti.UI.Label , Ti.UI.ImageView , ...) are still regular classes that are wrapped and providing user logic (!), for example, tracing its parent links, internal data structures, and locks between threads.

If you now examine an example Hyperloop native UITableView , you refer directly to equity, the API interface, so no proxy it will not need to manage partitions, templates, elements, etc. Of course, we deliver this API through the kroll proxy to display it in Titanium, but you don’t “jump between bridges” with every call you make from the SDK.

The easiest way to see this is to actually run a larger example, such as tableview, collectionview, and view-animation. If you take a quick look at them, you will already feel a performance improvement over the “classic” titanium API, simply because the only connection between your proxy and (for example, Ti.UI.Window that you want to add to) is .add() to get your own API like HyperloopClass .

Finally, of course, it still makes sense to use Ti.UI.ListView , for example, because it comes with built-in utilities that Titanium gives to love (events, simple setup and layout). But this is the advantage of Hyperloop, allowing the developer to access these APIs.

I hope this helps a little understanding of it.

+1
source

All Articles