We have an internal user that uses constant data to initialize package:timezone library. Due to lack of constant byte-array literals in the language, it uses a 400 KB string (close to half megabyte!), base64 decodes it and uses initializeDatabase.
This process can take 1ms on a fast modern workstation and probably 10ms+ on a mobile device. Since this is all done eagerly and synchronously, this is not very ideal - especially for startup performance.
It would be interesting to see if this could be done at compile-time: Take a data file and produce dart code that makes const Location(), const Timezone() objects. The main question is whether this would make the app significantly larger or not for common data files.
We have an internal user that uses constant data to initialize
package:timezone
library. Due to lack of constant byte-array literals in the language, it uses a 400 KB string (close to half megabyte!), base64 decodes it and usesinitializeDatabase
.This process can take 1ms on a fast modern workstation and probably 10ms+ on a mobile device. Since this is all done eagerly and synchronously, this is not very ideal - especially for startup performance.
It would be interesting to see if this could be done at compile-time: Take a data file and produce dart code that makes
const Location()
,const Timezone()
objects. The main question is whether this would make the app significantly larger or not for common data files.