Comments (5)
Hydra did not have .so files for the included modules, instead it linked the .m bits right into the Hydra binary. This provides some virtual memory pressure (the executable pages become demand paged) which is uninteresting; it causes some static allocation/initialisation (on the order of kilobytes I bet); and in theory it could cause code to get run on startup instead of on require, but this is something we can control when accepting modules.
If we are strict enough about the quality of modules we import, linking them all into our binary is an option. However, I don't see many benefits to this.
I also see no downsides to shipping .so files with all modules that have .m files, keeping memory entirely free of unused modules.
Opinions?
from hammerspoon.
Hi
I say let's let the data decide, by measuring the difference between implicitly loading all the modules and not.
Cheers,
Chris Jones
On 10 Oct 2014, at 18:03, Peter van Dijk [email protected] wrote:
Hydra did not have .so files for the included modules, instead it linked the .m bits right into the Hydra binary. This provides some virtual memory pressure (the executable pages become demand paged) which is uninteresting; it causes some static allocation/initialisation (on the order of kilobytes I bet); and in theory it could cause code to get run on startup instead of on require, but this is something we can control when accepting modules.
If we are strict enough about the quality of modules we import, linking them all into our binary is an option. However, I don't see many benefits to this.
I also see no downsides to shipping .so files with all modules that have .m files, keeping memory entirely free of unused modules.
Opinions?
—
Reply to this email directly or view it on GitHub.
from hammerspoon.
👍
from hammerspoon.
TLDR static linking all .m files will cause 0.5M of VM pressure and allocate a few hundred bytes.
With all modules available as rocks installed:
tesla:mjolnir peter$ pwd
/usr/local/lib/lua/5.2/mjolnir
tesla:mjolnir peter$ du -hs .
644K .
tesla:mjolnir peter$ find . -type f | xargs cat | wc -c
577072
tesla:mjolnir peter$ find . -type f -name '*.so' | xargs -n 1 size -m | grep bss | cut -f2 -d: | awk '{x=x+$1} END {print x}'
132
i.e. loading every .so will cause around 600kbyte of virtual mapping, and 132 bytes of static allocation.
tesla:mjolnir peter$ pwd
/usr/local/Cellar/luarocks/2.1.2_1/share/lua/5.2/mjolnir
tesla:mjolnir peter$ du -hs .
232K .
tesla:mjolnir peter$ find . -type f | xargs cat | wc -c
131243
furthermore, there is around 130kbyte of Lua source in all of the rocks combined (82kb of which is from _asm ;). A very generous estimate would be that on load, due to compilation, this turns into one megabyte -- but note that the topic is not 'preload all .lua?' but 'prelink all .so'.
from hammerspoon.
However, static linking makes it harder for third party devs/hackers to override things from within their custom versions of modules, forcing them to put their author prefix not just in the package name but also the name of their meta table, in theory. I think this would go alright in practice, the way the modules currently look, but I feel .so will give more flexibility.
from hammerspoon.
Related Issues (20)
- Repeatable hotkey keeps repeating when the callback function lasts too long HOT 3
- .
- `hs.wifi` not showing current network in Sonoma 14.2.1 HOT 3
- Opening Spoon's code on macOS removes the code
- hs.execute window opens in background
- Modifier key's single tapping problems.
- Cannot get all windows across all spaces for multi-instance applications (like firefox with profiles)
- Bug: changing brightness via BetterDisplay causes Hammerspoon to get stuck
- spaces.lua's search for Dock does not succeed on early startup HOT 3
- [bug] Hammerspoon (and forked child processes) can't see files in `/Applications` when launched as a Login Item HOT 10
- Unable to set global varable in Hammerspoon Lua HOT 13
- Hammerspoon crashes upon hs.reload(), and won't successfully execute again until macOS reboot
- Shift agruments in `hotkey.new`
- Is there a solution to implement SpaceFN
- Hammerspoon does not respond/hang when the frontmost application does not respond
- Feature Request: I would like to know if a modal is in the state active HOT 1
- Feature request: `:keydown` callback for `hs.chooser`
- Delete Preferences modal is confusing
- Moving Apps To Spaces HOT 2
- Memory is growing up to 2-4GB after some time - how to debug? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hammerspoon.