Skip to main content

Tally

Struct Tally 

Source
pub struct Tally {
    pub records: u64,
    pub skipped: u64,
    pub bytes: u64,
    pub padding: u64,
    pub uniform: u64,
    pub mixed: u64,
    pub blank: u64,
}
Expand description

How the bytes of some records fall into granules.

Everything here counts, so two tallies add, and the whole translation unit is the sum of its records.

Fields§

§records: u64

How many records were measured.

§skipped: u64

How many were too large to measure and were skipped.

§bytes: u64

How many bytes those records occupy in total.

§padding: u64

How many of those bytes have no effective type, meaning padding.

§uniform: u64

Granules whose typed bytes all agree, which cost one entry.

§mixed: u64

Granules whose typed bytes do not, which cost an entry and a sixteen byte side table.

§blank: u64

Granules with no typed bytes at all, which are padding to the end of the record.

Implementations§

Source§

impl Tally

Source

pub fn granules(&self) -> u64

How many granules were measured.

Source

pub fn disagreeing(&self) -> f64

The fraction of granules that need a side table, which is question 6’s h.

A blank granule needs no side table, so it counts as agreeing here even though nothing in it agrees about anything. Zero granules gives zero, because a translation unit that declares no records puts no pressure on the budget.

Source

pub fn ratio(&self, granule: u64) -> f64

Bytes of type plane per byte of program, under document 05’s compression.

One four byte entry per granule, plus a four byte per-byte side table over the whole granule for the ones that need one, so it is 4/g + 4h and the granule size only touches the first term. Tier D’s budget is 1.25 and the uncompressed plane is 4, which is also what this returns at a granule of one byte, since nothing disagrees with itself.

Source

pub fn absorb(&mut self, other: Tally)

Adds another tally into this one.

Trait Implementations§

Source§

impl Clone for Tally

Source§

fn clone(&self) -> Tally

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Tally

Source§

impl Debug for Tally

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Tally

Source§

fn default() -> Tally

Returns the “default value” for a type. Read more
Source§

impl Eq for Tally

Source§

impl PartialEq for Tally

Source§

fn eq(&self, other: &Tally) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Tally

Auto Trait Implementations§

§

impl Freeze for Tally

§

impl RefUnwindSafe for Tally

§

impl Send for Tally

§

impl Sync for Tally

§

impl Unpin for Tally

§

impl UnsafeUnpin for Tally

§

impl UnwindSafe for Tally

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.