From 8557f31f73aa816274efa5b53c4aadcfaa02acbf Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 20 Dec 2021 17:00:42 +0000 Subject: [PATCH] minor cpu savings --- .../Framework/Scenes/TerrainCompressor.cs | 30 +++++++------------ .../Handlers/Neighbour/NeighbourHandlers.cs | 2 -- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs b/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs index 82deafc7da..cb08b3a1d0 100644 --- a/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs +++ b/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs @@ -63,10 +63,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP if(Constants.TerrainPatchSize != 16) throw new Exception("Terrain patch size must be 16m x 16m"); - // Initialize the decompression tables - BuildDequantizeTable16(); + // Initialize the compression tables + BuildQuantizeTables16(); BuildCopyMatrix16(); - BuildQuantizeTable16(); } // Used to send cloud and wind patches @@ -387,29 +386,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Initialization - private static void BuildDequantizeTable16() - { - for (int j = 0; j < 16; j++) - { - int c = j * 16; - for (int i = 0; i < 16; i++) - { - DequantizeTable16[c + i] = 1.0f + 2.0f * (i + j); - } - } - } - - private unsafe static void BuildQuantizeTable16() + private unsafe static void BuildQuantizeTables16() { const float oosob = 2.0f / 16; - fixed(float* fQuantizeTable16 = QuantizeTable16) + float tmp; + fixed(float* fQuantizeTable16 = QuantizeTable16, fDeQuantizeTable16 = DequantizeTable16) { + float* dqptr = fDeQuantizeTable16; + float* qptr = fQuantizeTable16; + for (int j = 0; j < 16; j++) { - int c = j * 16; for (int i = 0; i < 16; i++) { - fQuantizeTable16[c + i] = oosob / (1.0f + 2.0f * (i + j)); + tmp = 1.0f + 2.0f * (i + j); + *dqptr++ = tmp; + *qptr++ = oosob / tmp; } } } diff --git a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs index 560216a35a..9ce38f1348 100644 --- a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs +++ b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs @@ -106,8 +106,6 @@ namespace OpenSim.Server.Handlers.Neighbour // TODO: unused: private bool m_AllowForeignGuests; protected void ProcessPostRequest(OSDMap args, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, UUID regionID) { - byte[] result = new byte[0]; - if (m_AuthenticationService != null) { // Authentication