| OLD | NEW |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 import 'dart:fletch'; | 5 import 'dart:dartino'; |
| 6 import 'dart:typed_data'; | 6 import 'dart:typed_data'; |
| 7 | 7 |
| 8 import 'package:socket/socket.dart'; | 8 import 'package:socket/socket.dart'; |
| 9 | 9 |
| 10 import '../BenchmarkBase.dart'; | 10 import '../BenchmarkBase.dart'; |
| 11 | 11 |
| 12 const int MESSAGE_SIZE = 256; | 12 const int MESSAGE_SIZE = 256; |
| 13 const int PING_PONG_COUNT = 1000; | 13 const int PING_PONG_COUNT = 1000; |
| 14 | 14 |
| 15 class SocketBenchmark extends BenchmarkBase { | 15 class SocketBenchmark extends BenchmarkBase { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 var buffer = new Uint8List(MESSAGE_SIZE).buffer; | 88 var buffer = new Uint8List(MESSAGE_SIZE).buffer; |
| 89 for (int i = 0; i < PING_PONG_COUNT; i++) { | 89 for (int i = 0; i < PING_PONG_COUNT; i++) { |
| 90 socket.write(buffer); | 90 socket.write(buffer); |
| 91 if (socket.read(MESSAGE_SIZE) == null) throw "Bad socket response"; | 91 if (socket.read(MESSAGE_SIZE) == null) throw "Bad socket response"; |
| 92 } | 92 } |
| 93 socket.close(); | 93 socket.close(); |
| 94 | 94 |
| 95 port.send(null); | 95 port.send(null); |
| 96 } | 96 } |
| 97 } | 97 } |
| OLD | NEW |