More perf issues with closure classes
See original GitHub issueLooks like V8 really hates those closure classes. Its taking 36s to generate 100 samples, with most of the time spent in the generate method of:
noBias(): Arbitrary<T> {
const arb = this;
return new class extends Arbitrary<T> {
generate(mrng: Random): Shrinkable<T> {
return arb.generate(mrng);
}
}();
}
Should I try to do a PR that removes them all?
Issue Analytics
- State:
- Created 5 years ago
- Comments:31 (30 by maintainers)
Top Results From Across the Web
Classes vs. Closures - Performance : r/javascript - Reddit
The real problem I have with inheritance is that it's brittle. It only takes one small, seemingly-insignificant change far up the inheritance ...
Read more >How to decide between classes v. closures in JavaScript
This tutorial compares the functionality and advantages of classes versus closures in JavaScript to help you determine which is best for ...
Read more >Reuse Java's closures/anonymous classes for performance?
When I use anonymous classes for small operations like filtering a collection, there is memory allocation for a new anonymous class instance or ......
Read more >Javascript Classes v. Closures (1/3) | by Richard Marmorstein
Javascript classes and closures are common patterns that can often substitute ... One advantage of the closure pattern is greater lintability.
Read more >On closures and classes in JavaScript and TypeScript | dragly
If all your functions are made to expect arguments that are interfaces and not specific classes or function signatures, then there is no...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I just replayed the tests on my computer by modifying
package.json
file between each performance test:Resulted in:
While:
Resulted in:
@spion Next version of fast-check will feature a way to change the random generator by setting the
randomType
attribute - see #200 - switching tocongruential32
might reduce the time taken to generate values.Meanwhile I am looking for ways to accelerate the generation of values by reducing gc, recompile…