• Joshua Haberman's avatar
    Optimized away the creation of empty string objects. · 1e37a94b
    Joshua Haberman authored
    Prior to this CL, creating an empty message object would create
    two empty string objects for every declared field.  First we
    created a unique string object for the field's default.  Then
    we created yet another string object when we assigned the
    default value into the message: we called #encode to ensure
    that the string would have the correct encoding and be frozen.
    
    I optimized these unnecessary objects away with two fixes:
    
    1. Memoize the empty string so that we don't create a new empty
       string for every field's default.
    2. If we are assigning a string to a message object, avoid creating
       a new string if the assigned string has the correct encoding and
       is already frozen.
    1e37a94b
Name
Last commit
Last update
..
defs.c Loading commit data...
encode_decode.c Loading commit data...
extconf.rb Loading commit data...
map.c Loading commit data...
message.c Loading commit data...
protobuf.c Loading commit data...
protobuf.h Loading commit data...
repeated_field.c Loading commit data...
storage.c Loading commit data...
upb.c Loading commit data...
upb.h Loading commit data...
wrap_memcpy.c Loading commit data...