<div dir="ltr">On Fri, Dec 18, 2015 at 4:34 PM, Janosch Hildebrand <span dir="ltr">&lt;<a href="mailto:jnosh@jnosh.com" target="_blank">jnosh@jnosh.com</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word">If you only care about having a simple cross-platform library, doing a simple implementation by yourself is fine. Also Swift (well, LLVM) is also pretty good at auto-vectorization so you get decent results for custom vector/matrix types.<br><div><div><br></div><div>However OpenGL-related code is usually pretty performance sensitive and the math parts doubly so, so I&#39;d recommend wrapping some appropriate libraries instead of writing your own...</div></div></div></blockquote><div><br></div><div>Multiplying two mat4x4 is one of the most complex and common operations. Doing 2 million of these...<br></div><div><br></div><div>C++: 1.3 seconds</div><div>Swift: 1.9 seconds</div><div><br></div><div>The C++ code is glm using packed SIMD operations. Swift is just plain whatever LLVM gave me with -O.</div><div><br></div><div>While implementing the multiplication I darn near fell out of my chair when the compiler said, &quot;Expression was too complex to be solved in reasonable time; consider breaking up the expression into distinct sub-expressions.&quot; I had to break it in half twice before the compiler stopped complaining about the math being too hard.<br></div><div><br></div><div>-<span style="font-size:13px">david (</span><a href="https://github.com/AE9RB/SwiftGL" target="_blank" style="font-size:13px">https://github.com/AE9RB/SwiftGL</a><span style="font-size:13px">)</span></div><div><br></div></div></div></div>