You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(database): eliminate redundant string and list allocations in postgresResultCellToDisplayString #1521
In lib/core/database/postgres_result_cells.dart (lines 53–85):
Date-Only Formatting:
if (value isDateTime) {
if (_isDateOnly(typeOid, dataTypeName)) {
return value.toIso8601String().split('T').first;
}
return value.toIso8601String();
}
Calling toIso8601String().split('T').first allocates a full 24-character string, a 2-element list, and the first element. On 100,000 date cells, this creates 200,000 transient objects.
Bytea / Binary Hex Encoding:
StringpostgresByteaHexDisplay(Uint8List bytes) {
final out =StringBuffer(r'\x');
for (final b in bytes) {
out.write(b.toRadixString(16).padLeft(2, '0'));
}
return out.toString();
}
b.toRadixString(16).padLeft(2, '0') allocates 2 new String objects per byte. For a 10 KB binary cell, this creates 20,000 String allocations for a single cell!
Proposed Solution
Replace toIso8601String().split('T').first with a dedicated date-only formatter:
Activity
Merge pull request #1615 from QueryaHub/issue/1529-cell-formatting