Comments (4)
Late loading seems like it would be bad for prefork memory usage. I'd be very sceptical of any PRs in that direction and would want to see data on memory usage for various deployment scenarios.
from mojo.
While I don't generally feel we need to micro-optimize module loading across the stack, I guess I can see that there are a few dependencies in Mojo::Util that could be easily late-loaded when needed and which are rarely needed unless in specific contexts. I would consider supporting a PR (good for first timers?) that late-loads some of those rarely used dependencies specifically in Mojo::Util.
[Edit: changed from implied promise to support to consider supporting]
from mojo.
In general that would be true, however, at least Pod::Usage would rarely need to be early-loaded for preforking. I guess I could argue GetOpt::Long either way, though in a non-webapp/Mojo::UserAgent context it would certainly seem to be a win.
On the other hand, it might make things a bit harder for say fat-packing deployments. Missing dependencies because they weren't detected at load-time. Though on the other-other hand, core modules like Pod::Usage and GetOpt::Long don't have to be fat-packed anyway.
I've been debating whether say the Socket dependencies in network_contains
would be worth late-loading, but yes, that would suffer from a preforking perspective. All of this is very interesting. @petdance do you have numbers on what the memory usage penalty is for those?
from mojo.
I don't have any memory usage penalty numbers, because I wasn't even at that point yet. So far, it's just a "Hmm, why is that here?"
Every so often I do a survey of modules that are loaded in our preloaded web app. Currently, we have 983 from Algorithm::Verhoeff to XML::Xerces. The goal is to make sure that everything gets early loaded (through a startup script if necessary) vs. late loaded. (I also make sure that there are no Test::* modules that get loaded somehow.)
While perusing the list, I was surprised to see the modules I mentioned above: Getopt::Long and the six Pod::*, since nothing in the app would every do anything with either of them. I tracked down what was bringing them in (since it wasn't in our code tree). (Thanks to Devel::TraceLoad!). And then I wrote this issue up.
So, no, I'm not saying "OMG your preloading is ruining my app!!11!1!!!". On the other hand, I could see it becoming a problem in the future pretty easily just by having something added to Mojo::Util. That's why my first thought, as someone who knows not much about Mojo, was to split CLI-only tools into Mojo::Util::CLI.
from mojo.
Related Issues (20)
- v5.38 and module_true: File "/app/x.pl" did not return an application object HOT 10
- Wrong explanation in sample what escapes XML and what is not (<%= vs <%==) HOT 1
- One t-test fails, Perl 5.38 on Windows 10 HOT 6
- The image helper now produces absolute paths HOT 7
- Mojolicious::Lite silently ignores controller configurations due to missing default namespaces HOT 2
- Morbo issues with Mojolicious 9.34 (change in Mojo/Server.pm) HOT 1
- t/mojo/log.t fails when $ENV{PERL_UNICODE} =~ /D/
- can't run mojo file
- running mojo files HOT 2
- TLS Fingerprinting
- Use of uninitialized value $cb in method lookup at Mojo/Reactor/Poll.pm HOT 1
- Can't locate object method "" via package "Mojolicious::Validator::Validation"
- Request with basic auth does not work when passwords include umlaut HOT 4
- Nesting layouts fails
- URL parsed from a serialised request is never absolute
- Websocket - 101 Switching Protocols
- Feeding render with Mojo::ByteStream is broken when gzipping is triggered HOT 4
- Missing SECURITY.md HOT 5
- Minion UI broken by jQuery removal in latest Mojolicious update HOT 2
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 mojo.