• Kevin Modzelewski's avatar
    Change the way we store and pass string data · 95ad7ffc
    Kevin Modzelewski authored
    Convert to BoxedString much sooner, and have any functions that
    might need to box a string take a BoxedString.  This means that
    on some paths, we will need to box when previously we didn't, but
    for callsites that we control we can just intern the string and
    not have to box again.  The much more common case is that we
    passed in unboxed string data, but then ran into a branch
    that required boxing.
    
    BoxedString shouldn't be that much more costly than std::string,
    and this should cut down on string allocations.
    
    For django-template.py, the number of strings allocated drops from
    800k to 525k; for virtualenv_test.py, it goes from 1.25M to 1.0M
    
    A couple things made this not 100% mechanical:
    - taking advantage of places that we could eliminate unbox/rebox pairs
    - different null-termination assumptions between StringRef and the c api.
    95ad7ffc
irgen.cpp 46.7 KB