-
Notifications
You must be signed in to change notification settings - Fork 30
cleaner lookup code #103
cleaner lookup code #103
Conversation
may also result in slight speed improvement.
e1d0748
to
62f12b5
Compare
@natefaubion should comment on this probably. I think it was written the way it is to improve the instance lookup overhead. We should probably add benchmarks to ensure we don't accidentally de-optimise things like this 😄 |
Ah, yes, I can see that being the case for the usage of |
Avoid instance lookup overhead.
Yeah, I think these changes are good. You could probably pull out |
Having a benchmarking library suitable for core libraries to depend on would be amazing. I think benchotron might have a few awkward dependencies. Then again if it's only going to be listed in devDependencies maybe that's not a problem. |
I just checked and all of benchotron's dependencies are either core libraries or under purescript-node. The only awkward dependency is benchmark.js which you currently have to obtain separately eg via npm. That's fairly easy to fix though, I think, by including it in an FFI file. There's also the issue of circular dependencies but I think that can be worked around without too much difficulty. |
Something at the level of |
I think benchotron is great, by the way, I just find that having big devDependencies can be a little bit of a pain when we do a major version bump in core, since we need to come back after those are updated and make sure the tests still work. |
The simplest thing we could do is to just add support for |
The dep on |
Another possibility is a separate repo for, say, collection benchmarks. |
discussion in purescript-deprecated#103 an optimization to reduce instance lookup
Done. I do wonder if any of the optimization tools out there would do this automatically, though. It feels like a bit of a hack, no? |
It is most definitely a hack, and can yield significant improvements. Ideally the compiler would pull it out in a similar manner. I don't think any of the bundlers pre-apply TC dictionaries.
… On Jun 2, 2017, at 9:33 AM, Matthew Leon ***@***.***> wrote:
You could probably pull out comp in the other lookups as well.
Done. I do wonder if any of the optimization tools out there would do this automatically, though. It feels like a bit of a hack, no?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Related, I think: purescript/purescript#687 |
Yeah exactly, the issue originally had a less general name, specifically talking about typeclass code :) |
Thanks! We can benchmark before this gets released if necessary. @matthewleon Were you able to do any simple benchmarks already? |
I'd like to suggest we use this library for simple benchmarks in core (after moving it into core, of course). The main issue right now is that it doesn't account for outliers very well. |
Not yet, sadly. It is my next priority, though. Early this week I should have something rudimentary up and running. |
The
lookup
function was particularly strangely written, perhaps a holdover from some earlier version of the type system that required more hinting?I'd be curious to benchmark this. I imagine that there might be a very slight performance improvement (pre-optimization) due to partially applying the lookup functions at the outset.