- You need to build the engine from source. Follow the steps at https://github.com/flutter/engine/blob/master/CONTRIBUTING.md#getting-the-code-and-configuring-your-environment
- You can skip the forking step if you don’t think you will be contributing changes to the engine.
- Once your environment is setup, build the engine in Release mode.
$ sky/tools/gn —release
$ ninja -C out/Release -j12
- After the long build you will find a Mac application called
SkyShell.app
inout/Release
. This is the generic Flutter application runner. It does not know anything about your dart project yet. - Create a sample dart project
$ flutter init -o mac_hello
- From the command line, launch the SkyShell.app with command line flags telling it where your dart project resides and its package root. On my system I did this:
$ ./out/Release/SkyShell.app/Contents/MacOS/SkyShell PATH_TO_PROJECT/lib/main.dart --package-root=PATH_TO_PROJECT/packages
This file contains hidden or 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
/** | |
* Based on Ben Trengrove's example: https://gist.github.com/bentrengrove/9759a3fbb564d62e1e63f417c58a3895 | |
*/ | |
package units | |
import java.util.concurrent.TimeUnit | |
abstract class Unit(val suffix: String, val ratio: Double) { | |
internal fun convertToBaseUnit(amount: Double) = amount * ratio | |
internal fun convertFromBaseUnit(amount: Double) = amount / ratio |
This file contains hidden or 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
import java.lang.reflect.* | |
import kotlin.reflect.KClass | |
import kotlin.reflect.KType | |
import kotlin.reflect.KTypeProjection | |
import kotlin.reflect.KVariance | |
import kotlin.reflect.full.createType | |
// --- Interface --- | |
inline fun <reified T : Any> getKType(): KType = |
This file contains hidden or 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
_hashCode java/lang/Object.hashCode()I | |
_getClass java/lang/Object.getClass()Ljava/lang/Class; | |
_clone java/lang/Object.clone()Ljava/lang/Object; | |
_dabs java/lang/Math.abs(D)D | |
_dsin java/lang/Math.sin(D)D | |
_dcos java/lang/Math.cos(D)D | |
_dtan java/lang/Math.tan(D)D | |
_datan2 java/lang/Math.atan2(DD)D | |
_dsqrt java/lang/Math.sqrt(D)D | |
_dlog java/lang/Math.log(D)D |
This file contains hidden or 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
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |