ianmackenzie/elm-geometry

Remove 'clever' optimization in rotation functions?

开放

#73 创建于 2018年9月17日

 (3 条评论) (0 个反应) (1 位负责人)Elm (28 个派生)auto 404
Hacktoberfest

仓库指标

星标
 (186 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Currently, rotateAround functions are optimized for partial application - they cache computed sines/cosines etc. in a returned lambda, which is then just immediately called and discarded if rotateAround is called with three arguments instead of two. This makes cases like

List.map (Point3d.rotateAround axis angle) points

more efficient since sines/cosines etc. are only calculated once, but

Point3d.rotateAround axis angle point

less efficent since a lambda function is allocated and then immediately discarded.

It may be better to switch to the 'naive' implementation, and use the 'frame trick' for efficient transformations where necessary. This would make efficient single calculations possible (currently there's no easy way to avoid the lambda-allocation overhead), and there would be a consistent story for optimization - just use frames!

贡献者指南