-
-
Notifications
You must be signed in to change notification settings - Fork 401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Benchmark refactor #640
Benchmark refactor #640
Conversation
Avoids code repetition between exec, full, lexer & parser.
Codecov Report
@@ Coverage Diff @@
## master #640 +/- ##
==========================================
+ Coverage 72.64% 72.92% +0.27%
==========================================
Files 179 178 -1
Lines 13275 13230 -45
==========================================
+ Hits 9644 9648 +4
+ Misses 3631 3582 -49
Continue to review full report at Codecov.
|
Accidentally forgot to run cargo fmt. Fixed now!
Can't quite work out why this is failing now, any help would be greatly appreciated! |
Hi @neeldug. The problem is that |
Ahh I see, thanks, will try something else then. |
Testing to see if benchmark runs here, can be moved elsewhere instead of src root.
Provides more descriptive location for bench scripts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The benchmarks shouldn't be exposed to the API, they should be isolated from it, instead of putting it in src/consts.rs
we should make the benchmarks multi-file ones, like the examples ones:
boa:
- benches:
- exec
- main.rs
- consts.rs
- full:
- main.rs
- consts.rs
...
But wouldn't this result in the code repetition that was initially the goal to avoid? In having the consts being separated by type? Although I do agree, it shouldn't be exposed to the API. |
Something that can be done is to have one file per each, and one |
So would you suggest having each static variable to be defined in a separate file, then using the include macro in a separate constants.rs, and then include those in each of the benchmarking files? |
We should try that, yes. |
bench_scripts contains each static var definition, then is included into constants.rs, then imported into each benchmark.
🚀 Hopefully works 🚀
Works, but includes every constant regardless of whether all are needed, also can cause IDE linking issues.
Fixes #639. Remaining issues: include macro forces each script to import unneeded variables and IDE compatibility lost. Moved all bench scripts to consts.rs Avoids code repetition between exec, full, lexer & parser. Used multiline import. Accidentally forgot to run cargo fmt. Fixed now! Added pub keyword. Moving consts to src, subject to move Testing to see if benchmark runs here, can be moved elsewhere instead of src root. Moving consts to benches Provides more descriptive location for bench scripts. Forgot to add to lib Trying out include macro for less code repetition. bench_scripts contains each static var definition, then is included into constants.rs, then imported into each benchmark. Fixed rust fmt issues... 🚀 Hopefully works 🚀 Incorrect path for includes! Using include for each benchmark! Works, but includes every constant regardless of whether all are needed, also can cause IDE linking issues.
…nto benchmark-refactor
Latest commit is fully functional, however, since it no longer uses EDIT: Works on local machine but strangely not CI, very strange behaviour. |
I had thought of using one file for all, but what you did is even better, and it brings some interesting posibilities. We can use JavaScript ( What do you think?
The error is giving is indeed strange. Not sure if it's related (probably isn't), but I saw that you added a line between the Jemallocator static and its configuration. Could we remove that? |
Actually, this seems very reasonable, and in fact seems better than the previous implementation since, it means raw JavaScript benchmarks can be written without having to deal with any rust formatting. But for the
Have removed the line, and will see on the next commit |
Using include_str macro to import consts, perhaps could avoid having constants.rs and instead import separately?
Strangely enough, same issue arises... Also numerous warnings spit out due to constants.rs being treated as a bench itself. Perhaps is solvable by putting constants.rs into the subdirectory as an index, and including it from there? |
We don't need that file. We can just include the code samples directly on each benchmark. |
Ahh, okay. Should I add all the import_str's at the top or next to each call? |
Static imports completed.
I think it's better at the call site, since we only use each once, right? |
🚀 Moving static includes to adjacent to functions for better organisation. 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good to go from my side :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great
This Pull Request fixes/closes #639 .
It changes the following:
consts.rs
static definitions
from various benchmarksPotentially could move ALLOC to consts.rs, however, am unsure about this.