Hi,
Based on what they said about Fletch during the conference videos that I watched, the primary purpose for Fletch is its interpretation of Dart code that is most useful on iOS. It seems to me that Fletch will work OK on Unix based systems, but initially it will not be developed for Windows. Right now anyone can test Fletch on Linux:
$ time ./out/ReleaseIA32/fletch_driver /home/dewd/t_/jungle/lion.dart
Using config file: /home/dewd/dice/yofletch/fletch/.fletch
Total: 3750025000
real 0m0.289s
user 0m0.002s
sys 0m0.000s
$ time ./out/ReleaseIA32/fletch_driver /home/dewd/t_/jungle/lion.dart --out /home/dewd/t_/jungle/lion.snapshot
Using config file: /home/dewd/dice/yofletch/fletch/.fletch
real 0m0.255s
user 0m0.000s
sys 0m0.002s
$ time ./out/ReleaseIA32/fletch /home/dewd/t_/jungle/lion.snapshot
Total: 3750025000
real 0m0.022s
user 0m0.021s
sys 0m0.000s
$ time /home/dewd/apps/dart/dart-sdk/bin/dart /home/dewd/t_/jungle/lion.dart
Total: 3750025000
real 0m0.121s
user 0m0.126s
sys 0m0.024s
$ cat /home/dewd/t_/jungle/lion.dart
class A {
cipo(n) {
return n % 2 == 0 ? n ~/ 2 : n + 1;
}
}
main() {
var total = 0, o = new A();
for (var i = 0; i < 100000; i++) {
total += o.cipo(i);
}
print("Total: ${total}");
}
On mobile, getting the startup to be fast is a great goal to have. With Fletch they seem to have broken it into 2 parts. One that will be responsible for interpreting directly from source code and creating a snapshot of it when it's ready for deployment. And the other one that will run the snapshot when it's deployed. When Fletch runs the snapshot it is the fastest one at that. The Fletch runtime is highly optimized to running the snapshot.
Another feature of Fletch is that it can spawn tens of thousands of processes with minimal memory requirements. This is for its concurrency feature. Fletch seems to use just the minimum number of native threads that matches the number of CPUs that the machine has. In some ways this is similar to what people do with Go which also enjoys a lot of support for concurrency.
Fletch is so quick at loading up and at spawning subprocesses that it could be used in CGI, FastCGI, command line tools, and even as its own whole HTTP server, I guess. And those uses are beside its main goal of being used for mobile applications.
What happens in a web service? You may connect to a database, process some data, and return its output and drop the connection and its thread and/or process. Even in an interpreted language that is no problem.
I'm not sure how Fletch relates to Sky yet. I haven't yet given Sky a try or a lot of thought.
The problem of Fletch not supporting Windows may be an important one. But Windows sucks for forking processes, which is more of a Unix thing. Given that many developers are on Windows, it will not be easy to ignore it. I think that Microsoft prefers features that fit into a single process, like Async programming.
Cheers,
Joao