diff options
author | chriseth <chris@ethereum.org> | 2017-08-23 19:26:43 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-23 19:26:43 +0800 |
commit | c5f11d938f6670d9dbe0d7212097089c757fd91a (patch) | |
tree | eaebaac04092d5b05a5cba1211b046467d3263ae /libevmasm/Assembly.cpp | |
parent | 0ffc5db82b24b4897d5d09cebbaadba37fa63b45 (diff) | |
parent | 4b56829ac3dc28ea9ca6945fee22963149bcc2bd (diff) | |
download | dexon-solidity-c5f11d938f6670d9dbe0d7212097089c757fd91a.tar.gz dexon-solidity-c5f11d938f6670d9dbe0d7212097089c757fd91a.tar.zst dexon-solidity-c5f11d938f6670d9dbe0d7212097089c757fd91a.zip |
Merge pull request #2656 from ethereum/performance1
Avoid some Json copy operations.
Diffstat (limited to 'libevmasm/Assembly.cpp')
-rw-r--r-- | libevmasm/Assembly.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/libevmasm/Assembly.cpp b/libevmasm/Assembly.cpp index 42b923df..0a3bf6b8 100644 --- a/libevmasm/Assembly.cpp +++ b/libevmasm/Assembly.cpp @@ -233,7 +233,7 @@ Json::Value Assembly::streamAsmJson(ostream& _out, StringMap const& _sourceCodes { Json::Value root; - Json::Value collection(Json::arrayValue); + Json::Value& collection = root[".code"] = Json::arrayValue; for (AssemblyItem const& i: m_items) { switch (i.type()) @@ -289,11 +289,9 @@ Json::Value Assembly::streamAsmJson(ostream& _out, StringMap const& _sourceCodes } } - root[".code"] = collection; - if (!m_data.empty() || !m_subs.empty()) { - Json::Value data; + Json::Value& data = root[".data"] = Json::objectValue; for (auto const& i: m_data) if (u256(i.first) >= m_subs.size()) data[toStringInHex((u256)i.first)] = toHex(i.second); @@ -304,7 +302,6 @@ Json::Value Assembly::streamAsmJson(ostream& _out, StringMap const& _sourceCodes hexStr << hex << i; data[hexStr.str()] = m_subs[i]->stream(_out, "", _sourceCodes, true); } - root[".data"] = data; } if (m_auxiliaryData.size() > 0) |