ianmackenzie/elm-geometry

Remove 'clever' optimization in rotation functions?

オープン

#73 opened on 2018/09/17

 (3 件のコメント) (0 件のリアクション) (1 人の担当者)Elm (28 件のフォーク)auto 404
Hacktoberfest

Repository metrics

Stars
 (186 個のスター)
PR merge metrics
 (PR metrics pending)

説明

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!

コントリビューターガイド