--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.
Thanks Matan.
On Mon, Nov 27, 2017 at 12:30 PM, Matan Lurey <ma...@lurey.org> wrote:
> The reason for AOT, specifically for Flutter, is that it impermissible on some mobile platforms to compile code (JIT), and fast-startup is a huge priority.
Apple's App Store JIT policy makes perfect sense as the initial
motivation for implementing AOT. Still, other use cases (eg: ease of
distribution of "binaries", confidentiality/obscurity of source code,
etc) might exist on linux.
Given that AOT has been implemented (for iOS), is it possible to
perform AOT on Linux?
> For running Linux applications via the command-line, I'd just recommend using the normal VM/JIT.
>
> You can improve startup a bit by creating snapshots (similar to the AOT process):
> https://github.com/dart-lang/sdk/wiki/Snapshots
Thanks for the pointers.
Best,
Andy
> Is it possible to AOT compile strong mode dart on linux?It is possible to AOT compile (or precompile) *any* Dart on Linux/Windows/MacOS (on x64, ARM or ARM64 architectures) as long as your code does not use mirrors.Unfortunately you can't do this purely by using the SDK, because binaries you need are not distributed with it at the moment.You would need to build Dart from sources. Make sure to build dart_precompiled_runtime and dart_bootstrap targets.
#!/usr/bin/dartlibrary hw2;import 'dart:async';import 'dart:isolate';import 'dart:io';Future<Null> serve(final SendPort sendport) async {final HttpServer httpd =await HttpServer.bind(InternetAddress.ANY_IP_V4, 8777, shared: true);print('Serving on port ${httpd.port}');await for (final HttpRequest req in httpd) {req.response..statusCode = 200..write("Hello World from Dart")..close();}}Future<Null> main(final List<String> args) async {final int cpuCount = Platform.numberOfProcessors;for (int i = 0; i < cpuCount; ++i) {await Isolate.spawn(serve, new ReceivePort().sendPort);}}
--
--
#!/usr/bin/dartimport 'dart:convert';import 'dart:io';import 'dart:isolate';const int _PORT = 9292;const String _HOST = '0.0.0.0';const String _GREET = 'Hello World';final ContentType _CONTENT_TYPE = new ContentType('text', 'plain');_startServer(arg) {final List<int> response = UTF8.encode(_GREET);HttpServer.bind(_HOST, _PORT, shared: true).then((server) {server.listen((HttpRequest request) {request.response..headers.contentType = _CONTENT_TYPE..add(response)..close();});});}void main() {final int _CORES = Platform.numberOfProcessors ~/ 2;print("Cores: $_CORES");for (int i = 0; i < _CORES - 1; ++i) {Isolate.spawn(_startServer, null);}_startServer(null);}
ab -n 786432 -c 128 -k http://localhost:9292/
g++ -pthread -s -o x -Ofast hw.cpp -lpistache
Results obtained (3 runs):ab -n 786432 -c 128 -k http://localhost:9080/
You received this message because you are subscribed to a topic in the Google Groups "Dart Misc" group.
To unsubscribe from this topic, visit https://groups.google.com/a/dartlang.org/d/topic/misc/BCfmQ6WTfNU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to misc+uns...@dartlang.org.