# Global Metrics

path: .metrics.halstead.difficulty
old: 18.079787234042552
new: 6.166666666666667
path: .metrics.halstead.bugs
old: 0.5839339507901175
new: 0.05474638132770338
path: .metrics.halstead.estimated_program_length
old: 654.1850998627082
new: 111.8901503327572
path: .metrics.halstead.level
old: 0.05531038540747279
new: 0.16216216216216214
path: .metrics.halstead.vocabulary
old: 105.0
new: 28.0
path: .metrics.halstead.length
old: 604.0
new: 71.0
path: .metrics.halstead.effort
old: 73320.84675950254
new: 2104.8202300408875
path: .metrics.halstead.n2
old: 94.0
new: 21.0
path: .metrics.halstead.N2
old: 309.0
new: 37.0
path: .metrics.halstead.time
old: 4073.380375527919
new: 116.93445722449376
path: .metrics.halstead.purity_ratio
old: 1.0830879136799805
new: 1.575917610320524
path: .metrics.halstead.N1
old: 295.0
new: 34.0
path: .metrics.halstead.n1
old: 11.0
new: 7.0
path: .metrics.halstead.volume
old: 4055.404292670338
new: 341.32219946608984
path: .metrics.mi.mi_visual_studio
old: 29.46374016610272
new: 39.2294640192292
path: .metrics.mi.mi_sei
old: 26.848261465453596
new: 68.18351586755857
path: .metrics.mi.mi_original
old: 50.38299568403565
new: 67.08238347288193
path: .metrics.loc.lloc
old: 0.0
new: 2.0
path: .metrics.loc.ploc
old: 81.0
new: 23.0
path: .metrics.loc.sloc
old: 114.0
new: 90.0
path: .metrics.loc.blank
old: 14.0
new: 12.0
path: .metrics.loc.cloc
old: 19.0
new: 55.0

# Spaces Data

## Minimal test - lines (14, 87)

path: .spaces[0].spaces[0].metrics.mi.mi_sei
old: 26.28268285337317
new: 74.63917767441745
path: .spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: 35.85759923207899
new: 41.680179140302755
path: .spaces[0].spaces[0].metrics.mi.mi_original
old: 61.31649468685508
new: 71.27310632991771
path: .spaces[0].spaces[0].metrics.halstead.bugs
old: 0.47381271782222967
new: 0.052323910781366494
path: .spaces[0].spaces[0].metrics.halstead.effort
old: 53591.01129686758
new: 1966.673096369596
path: .spaces[0].spaces[0].metrics.halstead.level
old: 0.05812220566318927
new: 0.15584415584415584
path: .spaces[0].spaces[0].metrics.halstead.time
old: 2977.278405381532
new: 109.25961646497755
path: .spaces[0].spaces[0].metrics.halstead.n2
old: 78.0
new: 18.0
path: .spaces[0].spaces[0].metrics.halstead.n1
old: 11.0
new: 7.0
path: .spaces[0].spaces[0].metrics.halstead.vocabulary
old: 89.0
new: 25.0
path: .spaces[0].spaces[0].metrics.halstead.N2
old: 244.0
new: 33.0
path: .spaces[0].spaces[0].metrics.halstead.volume
old: 3114.8277802948373
new: 306.49450852513183
path: .spaces[0].spaces[0].metrics.halstead.N1
old: 237.0
new: 33.0
path: .spaces[0].spaces[0].metrics.halstead.difficulty
old: 17.205128205128204
new: 6.416666666666667
path: .spaces[0].spaces[0].metrics.halstead.estimated_program_length
old: 528.3151208762656
new: 94.71013448036484
path: .spaces[0].spaces[0].metrics.halstead.purity_ratio
old: 1.0983682346699908
new: 1.4350020375812855
path: .spaces[0].spaces[0].metrics.halstead.length
old: 481.0
new: 66.0
path: .spaces[0].spaces[0].metrics.loc.blank
old: 3.0
new: 10.0
path: .spaces[0].spaces[0].metrics.loc.cloc
old: 2.0
new: 48.0
path: .spaces[0].spaces[0].metrics.loc.lloc
old: 0.0
new: 2.0
path: .spaces[0].spaces[0].metrics.loc.sloc
old: 65.0
new: 74.0
path: .spaces[0].spaces[0].metrics.loc.ploc
old: 60.0
new: 16.0

### Code

    namespace detail {
    // NOTE: these flags are declared public _only_ for convenience inside
    // the string implementation.  And they are outside of the string
    // class so that the type is the same for both narrow and wide
    // strings.

    // bits for mDataFlags
    enum class StringDataFlags : uint16_t {
      // Some terminology:
      //
      //   "dependent buffer"    A dependent buffer is one that the string class
      //                         does not own.  The string class relies on some
      //                         external code to ensure the lifetime of the
      //                         dependent buffer.
      //
      //   "refcounted buffer"   A refcounted buffer is one that the string class
      //                         allocates.  When it allocates a refcounted string
      //                         buffer, it allocates some additional space at
      //                         the beginning of the buffer for additional
      //                         fields, including a reference count and a
      //                         buffer length.  See nsStringHeader.
      //
      //   "adopted buffer"      An adopted buffer is a raw string buffer
      //                         allocated on the heap (using moz_xmalloc)
      //                         of which the string class subsumes ownership.
      //
      // Some comments about the string data flags:
      //
      //   REFCOUNTED, OWNED, and INLINE are all mutually exlusive.  They
      //   indicate the allocation type of mData.  If none of these flags
      //   are set, then the string buffer is dependent.
      //
      //   REFCOUNTED, OWNED, or INLINE imply TERMINATED.  This is because
      //   the string classes always allocate null-terminated buffers, and
      //   non-terminated substrings are always dependent.
      //
      //   VOIDED implies TERMINATED, and moreover it implies that mData
      //   points to char_traits::sEmptyBuffer.  Therefore, VOIDED is
      //   mutually exclusive with REFCOUNTED, OWNED, and INLINE.
      //
      //   INLINE requires StringClassFlags::INLINE to be set on the type.

      // IsTerminated returns true
      TERMINATED = 1 << 0,

      // IsVoid returns true
      VOIDED = 1 << 1,

      // mData points to a heap-allocated, shareable, refcounted buffer
      REFCOUNTED = 1 << 2,

      // mData points to a heap-allocated, raw buffer
      OWNED = 1 << 3,

      // mData points to a writable, inline buffer
      INLINE = 1 << 4,

      // mData points to a string literal; DataFlags::TERMINATED will also be set
      LITERAL = 1 << 5
    };

    // bits for mClassFlags
    enum class StringClassFlags : uint16_t {
      // |this|'s buffer is inline, and requires the type to be binary-compatible
      // with nsTAutoStringN
      INLINE = 1 << 0,
      // |this| requires its buffer is null-terminated
      NULL_TERMINATED = 1 << 1
    };

    MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(StringDataFlags)
    MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(StringClassFlags)

    }  // namespace detail

## Minimal test - lines (13, 88)

path: .spaces[0].metrics.halstead.N2
old: 304.0
new: 34.0
path: .spaces[0].metrics.halstead.estimated_program_length
old: 622.3205264746811
new: 100.36210720983136
path: .spaces[0].metrics.halstead.n1
old: 11.0
new: 7.0
path: .spaces[0].metrics.halstead.level
old: 0.053827751196172245
new: 0.15966386554621848
path: .spaces[0].metrics.halstead.volume
old: 3988.268678168325
new: 319.62990083359426
path: .spaces[0].metrics.halstead.bugs
old: 0.588027350058063
new: 0.05294674330235366
path: .spaces[0].metrics.halstead.n2
old: 90.0
new: 19.0
path: .spaces[0].metrics.halstead.time
old: 4116.287178949037
new: 111.21625204443778
path: .spaces[0].metrics.halstead.N1
old: 295.0
new: 34.0
path: .spaces[0].metrics.halstead.length
old: 599.0
new: 68.0
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.038932431510319
new: 1.4759133413210492
path: .spaces[0].metrics.halstead.vocabulary
old: 101.0
new: 26.0
path: .spaces[0].metrics.halstead.effort
old: 74093.16922108267
new: 2001.89253679988
path: .spaces[0].metrics.halstead.difficulty
old: 18.57777777777778
new: 6.2631578947368425
path: .spaces[0].metrics.mi.mi_visual_studio
old: 31.081720376079417
new: 41.165420059188214
path: .spaces[0].metrics.mi.mi_original
old: 53.14974184309579
new: 70.39286830121185
path: .spaces[0].metrics.mi.mi_sei
old: 25.983379259801147
new: 73.41092926383507
path: .spaces[0].metrics.loc.cloc
old: 11.0
new: 49.0
path: .spaces[0].metrics.loc.ploc
old: 75.0
new: 18.0
path: .spaces[0].metrics.loc.blank
old: 12.0
new: 9.0
path: .spaces[0].metrics.loc.sloc
old: 98.0
new: 76.0
path: .spaces[0].metrics.loc.lloc
old: 0.0
new: 2.0

### Code

    namespace mozilla {
    namespace detail {
    // NOTE: these flags are declared public _only_ for convenience inside
    // the string implementation.  And they are outside of the string
    // class so that the type is the same for both narrow and wide
    // strings.

    // bits for mDataFlags
    enum class StringDataFlags : uint16_t {
      // Some terminology:
      //
      //   "dependent buffer"    A dependent buffer is one that the string class
      //                         does not own.  The string class relies on some
      //                         external code to ensure the lifetime of the
      //                         dependent buffer.
      //
      //   "refcounted buffer"   A refcounted buffer is one that the string class
      //                         allocates.  When it allocates a refcounted string
      //                         buffer, it allocates some additional space at
      //                         the beginning of the buffer for additional
      //                         fields, including a reference count and a
      //                         buffer length.  See nsStringHeader.
      //
      //   "adopted buffer"      An adopted buffer is a raw string buffer
      //                         allocated on the heap (using moz_xmalloc)
      //                         of which the string class subsumes ownership.
      //
      // Some comments about the string data flags:
      //
      //   REFCOUNTED, OWNED, and INLINE are all mutually exlusive.  They
      //   indicate the allocation type of mData.  If none of these flags
      //   are set, then the string buffer is dependent.
      //
      //   REFCOUNTED, OWNED, or INLINE imply TERMINATED.  This is because
      //   the string classes always allocate null-terminated buffers, and
      //   non-terminated substrings are always dependent.
      //
      //   VOIDED implies TERMINATED, and moreover it implies that mData
      //   points to char_traits::sEmptyBuffer.  Therefore, VOIDED is
      //   mutually exclusive with REFCOUNTED, OWNED, and INLINE.
      //
      //   INLINE requires StringClassFlags::INLINE to be set on the type.

      // IsTerminated returns true
      TERMINATED = 1 << 0,

      // IsVoid returns true
      VOIDED = 1 << 1,

      // mData points to a heap-allocated, shareable, refcounted buffer
      REFCOUNTED = 1 << 2,

      // mData points to a heap-allocated, raw buffer
      OWNED = 1 << 3,

      // mData points to a writable, inline buffer
      INLINE = 1 << 4,

      // mData points to a string literal; DataFlags::TERMINATED will also be set
      LITERAL = 1 << 5
    };

    // bits for mClassFlags
    enum class StringClassFlags : uint16_t {
      // |this|'s buffer is inline, and requires the type to be binary-compatible
      // with nsTAutoStringN
      INLINE = 1 << 0,
      // |this| requires its buffer is null-terminated
      NULL_TERMINATED = 1 << 1
    };

    MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(StringDataFlags)
    MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(StringClassFlags)

    }  // namespace detail
    }  // namespace mozilla