-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Truffle speed improvements; remove extra compilation from tests #343
Truffle speed improvements; remove extra compilation from tests #343
Comments
Talking about the first part of this issue: (Every truffle command takes at least 4 seconds) I profiled the code and ~60% of time is spent in a C++ function which parses the module. Not all this code is required every time we run truffle, so the solution would be to make some of requires lazy. This will cut huge parts of dependency tree and load them on-demand. I propose to split by command, cause it's the most natural way to do it. We don't need to load a compiler dependencies on I already tested that approach on my computer and it speeds up a lot.
Here is my diff I had an idea of making the file
with
but this is currently not possible, cause we need all the command info for |
Talking about the second part of this issue: (Contracts are recompiled every time we run the tests) I wrote an example implementation that caches the precompiled contracts in tests. It's not perfect and it's a subject to discussion, but I personally am happy with that and I'm getting faster test runs. First I used temp directory compiled_test_contracts to store compiled contracts. So I just added some code for getting required deps, that does not require on paths and it started to work. I understand, that that is not a perfect solution and I'm opened for a discussion. |
#355 has been merged. Still looking into your solidity-test compile speed up, but it will come soon. Thanks again! |
It takes up to 2s to load |
In order not to compile every time you test, make sure your Take a look:
So best way to avoid unnecessary compilation is test with: Hope that helps. |
Monkey patch for now. Source: trufflesuite/truffle#343 Run with 'patch node_modules/truffle/build/cli.bundled.js truffle-test-cache.patch'
Monkey patch for now. Source: trufflesuite/truffle#343 Run with 'patch node_modules/truffle/build/cli.bundled.js truffle-test-cache.patch'
|
Monkey patch for now. Source: trufflesuite/truffle#343 Run with 'patch node_modules/truffle/build/cli.bundled.js truffle-test-cache.patch'
…busters#14) Monkey patch for now. Source: trufflesuite/truffle#343 Run with 'patch node_modules/truffle/build/cli.bundled.js truffle-test-cache.patch'
Assuming you have testrpc up, running |
truffle v4.0.0-beta2 patch file 301525c301525,301527
< temp.mkdir('test-', function(err, temporaryDirectory) {
---
> var temporaryDirectory = require('path').join(temp.dir, 'compiled_test_contracts');
> var mkTmpDir = cb=>!fs.existsSync(temporaryDirectory) ? fs.mkdir(temporaryDirectory, cb) : cb()
> mkTmpDir(function(err) { |
This issue now has a funding of 2.0 ETH (655.93 USDT) attached to it. To view or claim this funding, click here. |
Question: It looks like Zolmeister indicated he fixed this a couple of hours after it was funded. But, it doesn't look like he claimed the funding. Does it no longer need fixed, or is it still available? |
@isaacserafino the PR needs to be merged - trufflesuite/truffle-core#75 |
looks like the next step is for @tcoulter to do a PR review on trufflesuite/truffle-core#75 -- after that, if the team approves, i can payout the funding |
@Zolmeister sorry for radio ssilence.. looks like @tcoulter responded on trufflesuite/truffle-core#75 |
The funding of 2.0 ETH (1446.9 USD) attached has been claimed by @Ahmadposten. @Ahmadposten, please leave a comment to let the funder (@owocki) and the other parties involved your implementation plan. If you don't leave a comment, the funder may expire your claim at their discretion.
|
@Ahmadposten 👋 please introduce yourself. given that there's work ongoing here already... you might want to say hey to @isaacserafino and @Zolmeister et all and see if you can contribute |
@isaacserafino @Zolmeister I found out about this issue through gitcoin looking at the issue now I can see that you submitted PRs already |
@Ahmadposten I was in a similar position as you. I defer to @Zolmeister . Thank you. :) |
hey @Ahmadposten i just rejected your claim over at https://gitcoin.co/funding/details?url=https://github.com/trufflesuite/truffle/issues/343 since it looks like @Zolmeister is still lead on this. let me know if any concerns. @Zolmeister want to claim the funds at https://gitcoin.co/funding/details?url=https://github.com/trufflesuite/truffle/issues/343 ? ill ping the truffle folks today to see if theres any more review to be done! @benjamincburns @tcoulter i believe @Zolmeister needs a review over at trufflesuite/truffle-core#75 |
@owocki @Zolmeister To check in here, looks like the issue is still listed as Open on Gitcoin. Zoli - can you claim / Kevin, is this something on our side? Happy new year, all! |
hey @Zolmeister still interested in this? |
@owocki waiting for review - trufflesuite/truffle-core#75 |
@Zolmeister thanks.. mind claiming the issue at https://gitcoin.co/funding/details?url=https://github.com/trufflesuite/truffle/issues/343 ? |
@owocki I'm afraid that might cause it to take longer. It's already been 2 months to review a 22-line change (which significantly improves user experience). |
@Zolmeister go ahead and register your claim with the link that @owocki provided. I'm terribly sorry for the long delay on this. You clearly deserve this bounty. |
@Zolmeister Should you need gas to make the claim, DM me your MetaMask account info on slack and I can send some over :) |
The funding of 2.0 ETH (1770.69 USD) attached has been claimed . If you are the claimee, please leave a comment to let the funder (@owocki) and the other parties involved your implementation plan. If you don't leave a comment, the funder may expire your claim at their discretion.
|
The funding of 2.0 ETH (1770.69 USD) attached to this issue has been approved & issued .
|
@Zolmeister Congrats on completion! One of the biggest outbound bounties yet. Please feel free to DM us on Slack with any suggestions about the process, we'd love to hear from you. |
big claim alert! congrats 👍 👍 👍 |
Issue
Truffle could be faster. We need to profile it, find bottlenecks and implement some caching.
truffle version
takes 4s on my computertruffle test
with solidity tests doesn't cache compiled contracts and artifacts and rebuilds them on every runSteps to Reproduce
truffle version
truffle tests
with solidity testsExpected Behavior
truffle version
to be negligible.gitignore
Actual Results
Above^
Environment
The text was updated successfully, but these errors were encountered: