Re:Go command support for embedded static assets (files)
by zelly on Thursday July 23, 2020 @08:57PM
(#23934507)
Performance. No additional I/O at startup and guaranteed to be in memory.
[ Parent
| on HN ]
Re:Go command support for embedded static assets (files)
by jeffbee on Thursday July 23, 2020 @09:28PM
(#23934721)
I don't know what platform you had in mind, but this isn't generally true for Linux. No part of a Linux executable is in memory except the page containing the main entry point, initially. You'd have to pre-fault the sections of interest and protect them with mlock to make sure they stay in memory. If you don't their cached pages may be dropped, which is essentially the same thing as swapping.
In short, these embedded assets are no more likely to be in memory than any other file-backed data. If you want to guarantee they are in memory, it is up to you to make that happen.
Re:Go command support for embedded static assets (files)
by yencabulator on Friday July 24, 2020 @01:10PM
(#23941938)
Even then, it avoids open, path traversal, read read read, close.
More important is avoiding having to answer the question "where are my assets".