[librsvg: 14/14] gitlab#191 - Merge branch 'reduce-allocations'



commit 009e8e6a1a1905c08395d1b9520ef4c498398400
Merge: 3425537 d6cff8b
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Jan 24 13:01:10 2018 -0600

    gitlab#191 - Merge branch 'reduce-allocations'
    
    This reduces the number of allocations in the parsing stage.  We were
    doing from_glib_none(c_string) for all the incoming strings.  Since
    they come from libxml2, they are already valid UTF-8.
    
    We add a utility function, util::utf8_cstr(), that creates a &str from
    a *const libc::c_char without copies or allocations.
    
    We add a PropertyBag wrapper for the RsvgPropertyBag raw pointer (it's
    just a pointer to a GHashTable).
    
    We turn calls to from_glib_none(c_string) into utf8_cstr() where
    appropriate.
    
    This has very minor performance consequences, something hard to
    measure like 0.1% faster.  It definitely reduces the number of
    allocations and UTF-8 revalidations.
    
    https://gitlab.gnome.org/GNOME/librsvg/issues/191

 rust/src/chars.rs        | 16 +++++-----
 rust/src/clip_path.rs    |  4 +--
 rust/src/cnode.rs        |  8 ++---
 rust/src/color.rs        |  5 ++--
 rust/src/gradient.rs     |  7 ++---
 rust/src/image.rs        |  9 +++---
 rust/src/length.rs       |  3 +-
 rust/src/marker.rs       |  7 ++---
 rust/src/mask.rs         |  4 +--
 rust/src/node.rs         | 17 ++++++-----
 rust/src/opacity.rs      |  8 ++---
 rust/src/parsers.rs      |  8 +++--
 rust/src/pattern.rs      |  7 ++---
 rust/src/property_bag.rs | 76 +++++++++++++++++++++++++++++++++---------------
 rust/src/shapes.rs       | 19 ++++++------
 rust/src/space.rs        |  5 ++--
 rust/src/stop.rs         | 11 ++++---
 rust/src/structure.rs    | 46 ++++++++++-------------------
 rust/src/text.rs         |  5 ++--
 rust/src/transform.rs    |  5 ++--
 rust/src/util.rs         | 17 +++++++++++
 21 files changed, 160 insertions(+), 127 deletions(-)
---


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]