Code::Blocks must open all files at least twice, for two reasons:
1. code completion, this can be turned off
2. dependency calculation, tihs cannot be turned off
In practice, the file manager should hide the second load, and dependency calculation should only run once, too. The dependency information is cached in the .depends file, and in subsequent project loads, Code::Blocks only has to check the files' last modification dates.
Unluckily, while this is lightning fast on local drives, the performance for checking file attributes sucks big time over Samba, as nothing is cached, and so it costs at least one seek time and 2 RTTs, so at best 30-50 ms for every single file (assuming the file server does nothing else). Surely a few thousand queries are being painful in that light.
However, I don't see a way how this could be sped up. Code::Blocks must maintain a dependency chain to know what must be recompiled at which time. So... there's little it can do other than query every file for its modification data.