-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
My first go at `Numbas.jme.makeFast` worked with any number of arguments and free variables, so it used `Array.map()` to work over them all. For a fixed number of arguments for each operation and number of free variables, the function for each operation can be written directly in JS, without mapping over an array. This is a lot faster. This commit changes `Numbas.jme.makeFast` to use fixed arity functions when there are at most 5 free variables and 5 arguments to an operation. The expression `sin(x/2.0 + y)` is about half as fast as the native JS `Math.sin(x/2.0+y)`, which isn't bad!
- Loading branch information
1 parent
92a36e6
commit 8539ca4
Showing
3 changed files
with
252 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters