Slow performance on HelloWorld sample
See original GitHub issueDescription
Mythril takes a long time (4m47s on my Mac with --loop-bound 2
) for this sample:
pragma solidity ^ 0.5.2;
contract HelloWorld {
event SayHello(address id, string userMessage);
struct Participant {
address participant;
uint value;
}
address payable public owner;
Participant[] public participants;
constructor() public payable {
owner = msg.sender;
}
function helloWorld(string memory _userMessage) public returns(string memory) {
emit SayHello(msg.sender, _userMessage);
return _userMessage; //Only calls will return this as result
}
function sendETHToContract() public payable {
Participant memory participant;
participant.participant = msg.sender;
participant.value = msg.value;
participants.push(participant);
}
function sendContractETHToOwner() public {
owner.transfer(address(this).balance);
delete participants;
}
}
How to Reproduce
$ time $MYTH -v4 analyze HelloWorld.sol --loop-bound 2
==== Exception State ====
SWC ID: 110
Severity: Low
Contract: HelloWorld
Function name: participants(uint256)
PC address: 869
Estimated Gas Usage: 645 - 740
A reachable exception has been detected.
It is possible to trigger an exception (opcode 0xfe). Exceptions can be caused by type errors, division by zero, out-of-bounds array access, or assert violations. Note that explicit `assert()` should only be used to check invariants. Use `require()` for regular input checking.
--------------------
In file: HelloWorld.sol:13
] public participants;
constr
--------------------
Transaction Sequence:
Caller: [CREATOR], data: [CONTRACT CREATION], value: 0x0
Caller: [ATTACKER], data: 0x1706f851, value: 0x0
Caller: [CREATOR], data: 0x35c1d3498000000000000000000000000000000000000000000000000000000000000000, value: 0x0
real 4m47.807s
user 4m23.480s
sys 0m3.906s
Expected behavior
Perhaps some optimizations are possible here (memory?).
Environment
- Mythril version: Develop
- Solidity compiler and version: 0.5.7
- Python version:. 3.6.3
- OS and Version: Mac OS Mojave
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
“Hello world” is slower in C++ than in C (Linux)
I do not believe that printing 'hello world' itself should be slower or faster in C++ compared to C, at least not significantly....
Read more >Why is the Clojure Hello World program so slow compared to ...
As suggested by many people, it looks like this was because of the fact that clojure code was first compiled and then executed....
Read more >Running an end-to-end flow (HelloWorld sample) - IBM
The analysis flow creates an investigation when the assessment value is "High", "Medium," or "Low." Example of Assessment Actions. Verify the initialization ...
Read more >Benchmarking "Hello, World!" - ACM Queue
"A good performance evaluation provides a deep understanding of a ... helloworld.c, slowly revealing the underlying dynamics that are ...
Read more >“Hello world” is slower in C++ than in C (Linux) | Hacker News
He picked a completely unrealistic metric (console output is usually meant to be read by humans, so it was never optimized for +-...
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
@FranzHuebner if that’s too long you can still force an execution timeout like @norhh suggested above, e.g.
--execution-timeout 90
. It will cut analysis short in some cases so it’s a tradeoff between coverage and analysis speed.Can you create a separate bug report for the CentOS thing?
Of course. Thanks for the bug report 😃