utf converter seems to be slow #22330
Labels
area-web-js
Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop
dart2js-optimization
type-bug
Incorrect behavior (everything from a crash to more subtle misbehavior)
web-dart2js
According to http://stackoverflow.com/questions/28359949/how-to-convert-binary-data-to-utf8-string-after-dart2js utf8 encoding/decoding is slow in dart2js.
Load:
import 'dart:convert';
import 'package:archive/archive.dart';
import 'package:crypto/crypto.dart';
var base64 = CryptoUtils.base64StringToBytes(window.localStorage[storageName]);
var decompress = new GZipDecoder().decodeBytes(base64);
storage = JSON.decode(new Utf8Decoder().convert(decompress));
Save:
var g = JSON.encode(storage);
List<int> bz2 = new GZipEncoder().encode(new Utf8Encoder().convert(g));
window.localStorage[storageName] = CryptoUtils.bytesToBase64(bz2);
The text was updated successfully, but these errors were encountered: