archive icon indicating copy to clipboard operation
archive copied to clipboard

Improve performance request

Open salim-lachdhaf opened this issue 5 years ago • 1 comments

Thank you for this nice library.

I see that all your functions are sync. Is there any plan to provide async commands ?

salim-lachdhaf avatar May 19 '20 21:05 salim-lachdhaf

How does it help with the performance? You can turn a sync function to async in your code. See this aricle.

Example

import 'dart:async';
import 'dart:math';
void main() async {
  Future.microtask(_heavySyncFunction).then((value) => print('Heavy stask finished'));
  print('Heavy stask started');
}
void _heavySyncFunction() {
  var nums = List.generate(100000000, (i) => i);
  for (int i = 0; i < nums.length; i++) {
    nums[i] = sqrt(nums[i]).toInt();
  }
}

benfgit avatar Oct 01 '20 09:10 benfgit