Commit graph

3 commits

Author SHA1 Message Date
Terminator c4ed95a7d3
Performance enhancements for #141 (#173)
This PR also includes the Criterion benchmark.

## Before this commit
> Benchmarking BlockState::to_kind
> Benchmarking BlockState::to_kind: Warming up for 3.0000 s Benchmarking
BlockState::to_kind: Collecting 100 samples in estimated 20.045 s (273k
iterations) Benchmarking BlockState::to_kind: Analyzing
> BlockState::to_kind     time:   [68.925 µs 69.202 µs 69.477 µs]
> 
> Found 5 outliers among 100 measurements (5.00%)
>   4 (4.00%) high mild
>   1 (1.00%) high severe

## After this commit
> Benchmarking BlockState::to_kind
> Benchmarking BlockState::to_kind: Warming up for 3.0000 s Benchmarking
BlockState::to_kind: Collecting 100 samples in estimated 20.010 s (3.8M
iterations) Benchmarking BlockState::to_kind: Analyzing
> BlockState::to_kind     time:   [1.5814 µs 1.5859 µs 1.5912 µs]
> change: [-97.692% -97.678% -97.666%] (p = 0.00 < 0.05)
>                         Performance has improved.
> Found 4 outliers among 100 measurements (4.00%)
>   4 (4.00%) high mild

Co-authored-by: Ryan Johnson <ryanj00a@gmail.com>
2022-12-19 06:25:26 -08:00
Terminator c73abacc98
Re-visit From impl for native data types found in NBT data format. (#169) 2022-12-15 18:38:52 -08:00
Ryan Johnson 420f2d1b7c
Move protocol code to valence_protocol + redesigns (#153)
Closes #83 

This PR aims to move all of Valence's networking code to the new
`valence_protocol` crate. Anything not specific to valence is going in
the new crate. It also redesigns the way packets are defined and makes a
huge number of small additions and improvements. It should be much
easier to see where code is supposed to go from now on.

`valence_protocol` is a new library which enables interactions with
Minecraft's protocol. It is completely decoupled from valence and can be
used to build new clients, servers, tools, etc.

There are two additions that will help with #5 especially:
- It is now easy to define new packets or modifications of existing
packets. Not all packets need to be bidirectional.
- The `CachedEncode` type has been created. This is used to safely cache
redundant calls to `Encode::encode`.
2022-11-13 06:10:42 -08:00