B-C

 view release on metacpan or  search on metacpan

ramblings/yapceu2015.html  view on Meta::CPAN

    <!-- Abstract:
cPanel was using B::C with perl 5.6.2 for over 10 years successfully. Recently we switched to the new compiler and 5.14.4.
During this work my team ported the perl core test suite to test the compiler with it. We successfully pass all core tests as well as our own tests (i.e. no 5.6.2 regressions). We use it now for over a year in production. Developers are happy all aro...

Some XS modules caused problems, and I will outline those briefly. I'll also outline briefly our further plans with 5.22, the next target. 
    -->
    <textarea id="source">

# Using the new compiler in production

    YAPC EU, Granada Sep 2, 2015, 14:30
    20 min
    Reini Urban, cPanel

---
# cPanel

Running compiled perl binaries on 70% of the webhosters world-wide,
with Centos 5-7.

---
# cPanel

Running compiled perl binaries on 70% of the webhosters world-wide,
with Centos 5-7. Centos 6 mostly.

Providing the SW stack for them, on top of Centos.

---
# History

System perl on centos usually 5.8.8 or 5.10.1

cPanel perl 5.14.4

cPanel compiled perl: 5.6.2 => 5.14.4 (since 2014)
---
# History

Perl 5.6.2 2001 - 2014 compiled with hash randomization

Stable B::C compiler, in core until 5.8.9, broken with 5.10.
Custom patches, optimized linker, see my previous YAPC::EU 2010 in Pisa talk.
---
# Criteria for cPanel

* **memory**

  no memory hog on 500MB customer VMs

* no utf8

  just pass translations through, use bytes.

* compiled

  10-20% less memory, better startup, license
---
# Memory

![](yapceu2015/B-C.m0.png)
---
# Memory

![](yapceu2015/B-C.p0.png)
---
# Memory

![](yapceu2015/B-C.p1.png)
---
# Characteristics

A typical cPanel binary is 50MB

has ~200 module dependencies

has almost zero startup-time

perl5 bound run-time

and again almost zero destruction-time
---
# Characteristics

* 10-30% less memory

* 10-20% better startup time

* 100% faster destruction time
---
# Characteristics

Most modules are already compiled in

Shared libs are loaded at startup

Some bigger modules (XML) not constantly used
are run-time loaded from source *(not via `.pmc` or `.so` yet)*

No compilation to extra shared modules yet

---
# Characteristics

##Before

    Resident Size (perl 5.6)_____9756

    Resident Size (perlcc 5.6)___9072  (7%)

##After

    Resident Size (perl 5.14)____18704

    Resident Size (perlcc 5.14)__12091 (35%)
---
# Why 35% better?

Aggressive string optimizations with -O3, from dynamic to static.

---
# Why 35% better?

Aggressive string optimizations with -O3, from dynamic to static.

The compiler is also now 2-3x faster than the old compiler. The
build process was reduced from 2 hrs to 40 minutes.
---
# Why 35% better?



( run in 1.877 second using v1.01-cache-2.11-cpan-788537b7465 )