noxxi / p5-io-socket-ssl

IO::Socket::SSL Perl Module
36 stars 60 forks source link

Reduce memory footprint of IO::Socket::SSL #40

Closed atoomic closed 8 years ago

atoomic commented 8 years ago

Avoid import of Carp, only load it when required. Avoid importing everything from IO::Socket / Socket. Hide to the compiler the regexp with \w when using SSL_fingerprint. This is bringing some extra memory for no real advantages.

(master) > export A='use IO::Socket::SSL (); print qx{grep VmRSS /proc/$$/status}'; p14 -Ilib -e "$A"; p22 -Ilib -e "$A" VmRSS: 5940 kB VmRSS: 7460 kB

(devel/memory-improvement) > export A='use IO::Socket::SSL (); print qx{grep VmRSS /proc/$$/status}'; p14 -Ilib -e "$A"; p22 -Ilib -e "$A" VmRSS: 5856 kB VmRSS: 6752 kB

noxxi commented 8 years ago

Thanks for the participating. But I think that these are micro optimizations which are only relevant for minimal programs. With typical programs the effect will be minimal. And they might even cause harm for more complex programs or lead to increased memory usage: