Skip to main content

Posts

Showing posts with the label tip

New site for Dart news and articles

For the latest Dart news, visit our new blog at  https://medium.com/dartlang .

3 Tips for Benchmarking Dart Applications

John McCutchan shares three tips for  benchmarking your Dart application . Benchmarking is the act of measuring how much memory or CPU time your application takes to execute. The article focuses on CPU benchmarking and explains how to correctly set up a Dart benchmark. Make your code faster (Photo by Slooby ) The article covers these three important steps when benchmarking your Dart application: Perform a warm-up before measuring code performance. Ensure the code does not raise any errors when run in checked mode. Run your benchmark in production mode with debugging disabled. As always, the Dart team is interested in your feedback. Please join the Dart mailing list , ask questions on Stack Overflow , and file feature and bugs on dartbug.com .

Easy regex to update to new getter syntax

Posted by Seth Ladd Just spotted this gem from the Dart mailing list . Community member Kevin Moore offers this bit of advice for handling the syntax change for getters : """ This saved me a lot of code spelunking, so I wanted to share. Find: (get\s+[_a-zA-Z0-9]+)(\(\))(\s+(=>|\{)) Replace: $1$3 Make sure you have regex search on. Works great in Sublime. I think the same syntax works in Textmate and likely other editors. Nice results: https://github.com/kevmoo/dartlib/commit/3f2e3466091b71277967038cb686a5595639b5e5 """ With this tip, you'll change (old code): TInput get input() => _input; to (new code): TInput get input => _input; As of 11156 the VM runs the new syntax and dart2js warns if you're NOT using it. So now is a good time to update. Thanks Kevin!