Skip to content

Commit

Permalink
update bench
Browse files Browse the repository at this point in the history
  • Loading branch information
tafia committed Feb 9, 2017
1 parent bba0bfb commit e35d41c
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions benches/rust-protobuf/perftest_data_quick.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl Test1 {

impl MessageWrite for Test1 {
fn get_size(&self) -> usize {
self.value.as_ref().map_or(0, |m| 1 + sizeof_varint(*m as u64))
self.value.as_ref().map_or(0, |m| 1 + sizeof_varint(*(m) as u64))
}

fn write_message<W: Write>(&self, w: &mut Writer<W>) -> Result<()> {
Expand Down Expand Up @@ -60,7 +60,7 @@ impl TestRepeatedBool {

impl MessageWrite for TestRepeatedBool {
fn get_size(&self) -> usize {
self.values.iter().map(|s| 1 + sizeof_varint(*s as u64)).sum::<usize>()
self.values.iter().map(|s| 1 + sizeof_varint(*(s) as u64)).sum::<usize>()
}

fn write_message<W: Write>(&self, w: &mut Writer<W>) -> Result<()> {
Expand Down Expand Up @@ -90,11 +90,11 @@ impl TestRepeatedPackedInt32 {

impl MessageWrite for TestRepeatedPackedInt32 {
fn get_size(&self) -> usize {
if self.values.is_empty() { 0 } else { 1 + sizeof_len(self.values.iter().map(|s| sizeof_varint(*s as u64)).sum::<usize>()) }
if self.values.is_empty() { 0 } else { 1 + sizeof_len(self.values.iter().map(|s| sizeof_varint(*(s) as u64)).sum::<usize>()) }
}

fn write_message<W: Write>(&self, w: &mut Writer<W>) -> Result<()> {
w.write_packed_with_tag(10, &self.values, |w, m| w.write_int32(*m), &|m| sizeof_varint(*m as u64))?;
w.write_packed_with_tag(10, &self.values, |w, m| w.write_int32(*m), &|m| sizeof_varint(*(m) as u64))?;
Ok(())
}
}
Expand Down Expand Up @@ -124,9 +124,9 @@ impl TestRepeatedMessages {

impl MessageWrite for TestRepeatedMessages {
fn get_size(&self) -> usize {
self.messages1.iter().map(|s| 1 + sizeof_len(s.get_size())).sum::<usize>()
+ self.messages2.iter().map(|s| 1 + sizeof_len(s.get_size())).sum::<usize>()
+ self.messages3.iter().map(|s| 1 + sizeof_len(s.get_size())).sum::<usize>()
self.messages1.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
+ self.messages2.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
+ self.messages3.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
}

fn write_message<W: Write>(&self, w: &mut Writer<W>) -> Result<()> {
Expand Down Expand Up @@ -162,9 +162,9 @@ impl TestOptionalMessages {

impl MessageWrite for TestOptionalMessages {
fn get_size(&self) -> usize {
self.message1.as_ref().map_or(0, |m| 1 + sizeof_len(m.get_size()))
+ self.message2.as_ref().map_or(0, |m| 1 + sizeof_len(m.get_size()))
+ self.message3.as_ref().map_or(0, |m| 1 + sizeof_len(m.get_size()))
self.message1.as_ref().map_or(0, |m| 1 + sizeof_len((m).get_size()))
+ self.message2.as_ref().map_or(0, |m| 1 + sizeof_len((m).get_size()))
+ self.message3.as_ref().map_or(0, |m| 1 + sizeof_len((m).get_size()))
}

fn write_message<W: Write>(&self, w: &mut Writer<W>) -> Result<()> {
Expand Down Expand Up @@ -200,9 +200,9 @@ impl<'a> TestStrings<'a> {

impl<'a> MessageWrite for TestStrings<'a> {
fn get_size(&self) -> usize {
self.s1.as_ref().map_or(0, |m| 1 + sizeof_len(m.len()))
+ self.s2.as_ref().map_or(0, |m| 1 + sizeof_len(m.len()))
+ self.s3.as_ref().map_or(0, |m| 1 + sizeof_len(m.len()))
self.s1.as_ref().map_or(0, |m| 1 + sizeof_len((m).len()))
+ self.s2.as_ref().map_or(0, |m| 1 + sizeof_len((m).len()))
+ self.s3.as_ref().map_or(0, |m| 1 + sizeof_len((m).len()))
}

fn write_message<W: Write>(&self, w: &mut Writer<W>) -> Result<()> {
Expand Down Expand Up @@ -234,7 +234,7 @@ impl<'a> TestBytes<'a> {

impl<'a> MessageWrite for TestBytes<'a> {
fn get_size(&self) -> usize {
self.b1.as_ref().map_or(0, |m| 1 + sizeof_len(m.len()))
self.b1.as_ref().map_or(0, |m| 1 + sizeof_len((m).len()))
}

fn write_message<W: Write>(&self, w: &mut Writer<W>) -> Result<()> {
Expand Down Expand Up @@ -278,14 +278,14 @@ impl<'a> PerftestData<'a> {

impl<'a> MessageWrite for PerftestData<'a> {
fn get_size(&self) -> usize {
self.test1.iter().map(|s| 1 + sizeof_len(s.get_size())).sum::<usize>()
+ self.test_repeated_bool.iter().map(|s| 1 + sizeof_len(s.get_size())).sum::<usize>()
+ self.test_repeated_messages.iter().map(|s| 1 + sizeof_len(s.get_size())).sum::<usize>()
+ self.test_optional_messages.iter().map(|s| 1 + sizeof_len(s.get_size())).sum::<usize>()
+ self.test_strings.iter().map(|s| 1 + sizeof_len(s.get_size())).sum::<usize>()
+ self.test_repeated_packed_int32.iter().map(|s| 1 + sizeof_len(s.get_size())).sum::<usize>()
+ self.test_small_bytearrays.iter().map(|s| 1 + sizeof_len(s.get_size())).sum::<usize>()
+ self.test_large_bytearrays.iter().map(|s| 1 + sizeof_len(s.get_size())).sum::<usize>()
self.test1.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
+ self.test_repeated_bool.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
+ self.test_repeated_messages.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
+ self.test_optional_messages.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
+ self.test_strings.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
+ self.test_repeated_packed_int32.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
+ self.test_small_bytearrays.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
+ self.test_large_bytearrays.iter().map(|s| 1 + sizeof_len((s).get_size())).sum::<usize>()
}

fn write_message<W: Write>(&self, w: &mut Writer<W>) -> Result<()> {
Expand Down

0 comments on commit e35d41c

Please sign in to comment.