shamblett / coap

A Coap package for dart
Other
16 stars 13 forks source link

Remove executor dependency #111

Closed JosefWN closed 2 years ago

JosefWN commented 2 years ago

I don't think this is necessary, the executor is also using darts task queue (not isolates), so we could as well use dart's task queue directly? Leaving it as a draft until I've had time to test more, but remove it didn't seem to affect performance at first glance, and the library doesn't seem that popular or well maintained.

The reason I dug into it was because of the uncatchable exceptions I've been seeing in #110 (but this doesn't seem to solve the problem).

# With executor
dart sync_vs_async.dart
Sending 100 async requests...
100 async requests took 67 ms
Sending 100 sync requests...
100 sync requests took 3965 ms

# Without executor
dart sync_vs_async.dart
Sending 100 async requests...
100 async requests took 65 ms
Sending 100 sync requests...
100 sync requests took 3784 ms

It even seems a bit faster, but I haven't run that many benchmarks :)

All examples seem to work (save the observe issues solved by my other PR).

JosefWN commented 2 years ago

Speaking of dependencies, we could also consider changing hex to convert (Dart's official library for conversions to hex and other formats), it's a bit bigger but it looks like it's better maintained and seems like a more optimized/less naive implementation at first glance?

EDIT: https://github.com/shamblett/coap/pull/112 :)