Haskell-Things / Haskell-Things/ImplicitCAD

getImplicit implementations should lift recursive calls outside of the lambda

Open
#357 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.6k
Forks
148
PR merge metrics
No merged PRs in 30d

Description

eg:

https://github.com/colah/ImplicitCAD/blob/742638a33e92d814267481b0fd7418b9a7afc050/Graphics/Implicit/ObjectUtil/GetImplicitShared.hs#L56-L57

Because the let binding is inside the lambda here, the runtime is going to call `getImplicit` on every child for every point it samples. If we instead pull it out:

```haskell
getImplicitShared (UnionR r symbObjs) =
let objs = fmap getImplicit symbObjs
in \p -> rminimum r $ fmap ($ p) objs
```

we can amortize that work

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.