← Back to team overview

widelands-dev team mailing list archive

Re: [Merge] lp:~widelands-dev/widelands/inputwarequeue_display into lp:widelands

 

1 small comment for performance

Diff comments:

> === modified file 'src/economy/input_queue.cc'
> --- src/economy/input_queue.cc	2018-04-07 16:59:00 +0000
> +++ src/economy/input_queue.cc	2018-07-22 09:47:47 +0000
> @@ -120,6 +120,13 @@
>  	update();
>  }
>  
> +uint32_t InputQueue::get_missing() const {
> +	if (get_filled() >= max_fill_ || request_ == nullptr || !request_->is_open()) {

How is get_filled() calculated? It it's more than just returning a variable, it will be more efficient to have const auto currently_filed = get_filled(); at the top.

> +		return 0;
> +	}
> +	return max_fill_ - get_filled() - std::min(max_fill_, request_->get_num_transfers());
> +}
> +
>  constexpr uint16_t kCurrentPacketVersion = 3;
>  
>  void InputQueue::read(FileRead& fr, Game& game, MapObjectLoader& mol) {


-- 
https://code.launchpad.net/~widelands-dev/widelands/inputwarequeue_display/+merge/350385
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/inputwarequeue_display into lp:widelands.


References