bmroberts1987 / syntaxhighlighter

Automatically exported from code.google.com/p/syntaxhighlighter
GNU General Public License v3.0
0 stars 0 forks source link

syntaxhighligher is very slow at processing this code - causes browser to hang #139

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

<pre name="code" class="csharp">
public static class ModelExtensionMethods
{
    public static void DrawMany(this Model model, Matrix projectionMatrix, 
Matrix viewMatrix, Matrix[] worldMatrices)
    {
        // Generate bone matrices
        Matrix[] boneMatrices = new Matrix[model.Bones.Count];
        model.CopyAbsoluteBoneTransformsTo(boneMatrices);

        // Render each mesh in the model lots of times
        foreach (ModelMesh mesh in model.Meshes)
        {
            // Obtain a reference to the graphics device from one of the 
model's GPU resources
            // (they should all share the same graphics device)
            GraphicsDevice graphicsDevice = 
mesh.IndexBuffer.GraphicsDevice;

            graphicsDevice.Indices = mesh.IndexBuffer;

            foreach (ModelMeshPart part in mesh.MeshParts)
            {
                graphicsDevice.Vertices[0].SetSource(mesh.VertexBuffer, 
part.StreamOffset, part.VertexStride);
                graphicsDevice.VertexDeclaration = part.VertexDeclaration;

                BasicEffect basicEffect = part.Effect as BasicEffect;
                basicEffect.Projection = projectionMatrix;
                basicEffect.View = viewMatrix;

                basicEffect.Begin();

                foreach (EffectPass effectPass in 
basicEffect.CurrentTechnique.Passes)
                {
                    effectPass.Begin();

                    foreach (Matrix instance in worldMatrices)
                    {
                        basicEffect.World = boneMatrices
[mesh.ParentBone.Index] * instance;
                        basicEffect.CommitChanges();
                        graphicsDevice.DrawIndexedPrimitives
(PrimitiveType.TriangleList, part.BaseVertex, 0, part.NumVertices, 
part.StartIndex, part.PrimitiveCount);
                    }

                    effectPass.End();
                }

                basicEffect.End();
            }
        }
    }
}
</pre>

What is the expected output? What do you see instead?

The above code causes the browser to hang (I've never waited long enough 
to actually see a result).

What version of the product are you using? On what operating system?

I'm using the latest version of syntaxhighligher. I'm running on a Windows 
Vista machine, in Internet Explorer 7

Original issue reported on code.google.com by james.an...@gmail.com on 18 Jan 2009 at 11:38