Google has released version 1.4 of its open source web programming language Dart. The release brings with it a new tool for performance analysis called Observatory and ServerSocket references, an experimental feature in dart:io.
In the release documentaton for the tool Google says Observatory "allows you to peek inside a running Dart virtual machine (VM) on demand and provides live, immediate reporting of data." Among Observatory's features is the ability to determine where an app is spending its time, examine allocated memory, and see which lines of code have executed.
Dart committer Kevin Moore announced Observatory in his article Dart 1.4 Brings Deep Visbility to Run Applications, and says Observatory will "continue to evolve and improve in future releases." Moore says contributors are already looking at mobile support that will allow users to debug a dart app running on a phone, and actively working on support for managed VMs in the cloud.
Feedback on the new release from the Dart "Dartisan" developer community greeted the announcements. Róbert Tóth, developer of DartRocket, an HTML5 game engine, said:
I just tried this out on my example game and it really helped to see how the game ran, although I found the need for a manual refresh a pain. I was never into profiling, but I've found this easy to use and helpful.
Further comment came from Dan Schultz, lead developer for Mixbook. Mixbook made the news in November last year with the announcement that the company had rejected both JavaScript and TypeScript in favour of Dart to power its photobook creation tool. Schultz said:
This is a great start. But, in order to be useful, it definitely needs support for finding memory leaks and profiling execution times of functions. In my experience, memory leaks in Dart are most likely to occur around observers, streams and passing around lazy iterables. Any tools that can help pin down these issues would be helpful.
John McCutchan, the driving force behind Observatory, told InfoQ
In the future, we will provide detailed information for server applications, for example, how many HTTP connections do we have in the moment and how much bandwidth has each individually used. We will provide more ways for programs to hook into Observatory and display custom data. In general, we will continue to expand upon what you can introspect in a Dart program from Observatory.
Aside from the performance analysis tool, 1.4 also brings with it other updates. Speaking to InfoQ, Moore said the experimental ServerSocket references feature in dart:io has the potential to drastically improve performance.
Addressing the feature in the Dart Misc discussion group on dartlang.org Anders Johnsen stressed that it is still "very experimental" but that it is "an important new feature for making isolates more valuable in the context of dart:io." He said:
A ServerSocket reference can be acquired from a ServerSocket and can be transferred to other isolates. From this reference, it's possible to create a clone of the original ServerSocket, that will share the native socket. This makes it possible to accept incoming connections on multiple isolates, on the same network interface.
Google also includes in 1.4 updates to the Dart Editor tool. Release notes for the version mentions that Editor's ‘Expressions’ view now works for command-line apps when debugging. Other improvements include support for 'Rename' refactoring from HTML editor, a quick fix for replacing 'new' instance creation with 'const' where constant is expected, and the Pub Serve launch configuration now supporting debugging. The update also brings with it to Dart Editor code completion for Angular directive attributes.
In the core SDK, dart:convert and dart:collection both have updates. The former's update notes that "JsonEncoder now has a withIndent constructor to create 'pretty' output" while dart:collection includes "New Map classes - MapBase, UnmodifiableMapBase, MapView, UnmodifiableMapView".
Moore says that the Dart team welcome contributions, and that Dart is a "community project". InfoQ readers looking to contribute to Dart can help by reporting bugs and answering questions on StackOverflow, as well as contributing code. More information on contributing to Dart is here.