添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
I'm ported node_redis to Dart language. https://github.com/DisDis/dart_redis
I found big problem. Redis uses UTF8, Dart uses UTF16.
I used "UTF8.decode" for convert input socket data.
String bufferToString(List<int> data) => UTF8.decode(data);
But that is bad performance(lose 56%).

How to set/get internal byte(0-255) list of string?

P.S.: string.codeUnits return int(0-65535) list.
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new

To unsubscribe from this group and stop receiving emails from it, send an email to misc+unsubscribe-dYxm/***@public.gmane.org
Hi,

To convert between String and UTF8 encoded bytes, you should use:

UTF8.decode(List<int> bytes) / UTF8.encode(String string)

from the 'dart:convert' library, as you correctly do.

On the server-side, UTF8.decode will in most cases return a Uint8List while
in the browser a List<int>. This is because we are still supporting
browsers, where typed data is not implemented.

Do you have an example where you see this slow performance, as it may be an
unoptimized case in our converters?

Cheers,

- Anders
Post by Игорь Демьянов
I'm ported node_redis to Dart language.
https://github.com/DisDis/dart_redis
I found big problem. Redis uses UTF8, Dart uses UTF16.
I used "UTF8.decode" for convert input socket data.
String bufferToString(List<int> data) => UTF8.decode(data);
But that is bad performance(lose 56%).
How to set/get internal byte(0-255) list of string?
P.S.: string.codeUnits return int(0-65535) list.
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new

To unsubscribe from this group and stop receiving emails from it, send an email to misc+unsubscribe-dYxm/***@public.gmane.org